Hi Alan,
I did the same experiment, with the same variable names too :) have a look 
at the github issue.
Finally I discovered prevayler calls reset method on oos every time it 
writes to it. This is why the overhead is written every time. Klaus, 
prevayler author, says it is so to prevent leaks and I still don't 
understand which leaks he refers to. But the difference in size has an 
explanation now. 

Thanks,
Luca

Il giorno sabato 8 agosto 2015 01:48:51 UTC+2, Alan Malloy ha scritto:
>
> You must be doing something wrong, or describing your method badly, 
> because the vector [:a1 1] doesn't take nearly that much space in my 
> experiments. The first object you write to a stream requires quite a bit of 
> overhead, but after that future objects are relatively cheap. Here's an 
> example you can try yourself:
>
> user> (def baos (ByteArrayOutputStream.))
> user> (def oos (ObjectOutputStream. baos))
> user> (.writeObject oos [:a1 1])
> user> (.size baos)
> 671
> user> (.writeObject oos [:a1 1])
> user> (.size baos)
> 719
> user> (.writeObject oos [:a1 1])
> user> (.size baos)
> 767
> user> (.writeObject oos [:x 2])
> user> (.size baos)
> 845
>
> So the first write takes around 600 bytes of overhead, and each write of 
> [:a1 1] takes around 40-50 bytes. Writing a new vector with two different 
> objects takes more, because it can't reuse references to constants like 
> :a1, but it is still just 80 bytes. Nowhere near 1KB per small vector.
>
>>
>>>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to