I've had some success using edn on one of my little projects.

First a little background:

We're running a code generator written in Clojure which consumes
homogenous collections of Clojure maps and producing a Java enum for
each such collection. (The input data is basically 'edn' except that
all values are strings since the Excel macro exporting the input data
it too stupid to do anything more sophisticated.)

These generated enums are more than just an identity, they also carry
additional (immutable) scalar attributes. Some enums are so large in
number of members or number of attributes that we were bursting the
64KB method-size limit on the static initializer of the generated
Enum class.

To solve this problem, these additional attributes were moved out into
a separate file, from which the data was retrieved to initialize the
each enum's attributes at class loading time.

The initial solution:

The initial solution used Java serialization for this attribute
data. This had two unfortunate properties:

 1. Serialized data is not diff/merge friendly.

 2. It proved useful to repeat all the attributes and their values as
    a giant comment in the generated source code. (This made the enum
    less opaque for the programmer using it.)

Using EDN:

I've now completed initial work on a feature branch which uses edn for
data storage in place of serialization. I'm pleased with the results.

The 'edn' data is over twice as large as the serialized data it's
replacing, but after compression the difference is less than
50%. Initializing the enums from the approximately 6 MB of edn data
takes about twice as long as from the serialized data (0.8 versus
0.4s).

Yes, it's bigger and slower than what it's replacing, but in our case
it's sufficiently small and sufficiently fast while at the same time
addressing points 1 and 2 above. That's a win.

I'm using 0.1-SNAPSHOT of my github.com/bpms/edn-java to do the
parsing. edn-java has also benefited from seeing some real
use. Still lots more to do on that front though.


  // Ben

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

Reply via email to