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.

On Friday, August 7, 2015 at 6:31:46 AM UTC-7, icamts wrote:
>
> Yes. I suggested nippy. The question is about the size of Java serialized 
> Clojure data structures. Can a two element vector be 1kB in size? Why 
> serialization in my REPL experiment (see the code following the link in my 
> previous mail) produces a 80MB byte buffer while prevayler logs are 1GB?
>
> Il giorno venerdì 7 agosto 2015 13:51:45 UTC+2, Gary Verhaegen ha scritto:
>>
>> You should probably look at Clojure-specific solutions, starting with EDN 
>> (i.e. essentially pr-str), fressian, transit or nippy.
>>
>> Clojure data structures have a lot of properties that can be exploited 
>> (we only care about the abstract type and the actual data), so a serializer 
>> can make a lot of assumptions that a generic Java solution can't.
>>
>>>
>>>

-- 
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