On Tue, Aug 11, 2009 at 2:31 PM, fft1976 wrote:
> On Aug 11, 8:36 am, John Harrop wrote:
>
> > System.identityHashCode() and IdentityHashMap. These use a hash that
> > respects reference equality. So one in fact can implement one's own
> > serialization that is O(n) using O(1) hashmap lookups (a
On Aug 11, 8:15 am, John Harrop wrote:
> Which in turn gives us this, otherwise sorely lacking from the Java standard
> library, but much less useful to us Clojurians who tend to mainly use
> immutable objects:
>
> (defn deep-copy [obj]
> (thaw (freeze obj)))
Somebody should benchmark that vs
On Aug 11, 8:36 am, John Harrop wrote:
> System.identityHashCode() and IdentityHashMap. These use a hash that
> respects reference equality. So one in fact can implement one's own
> serialization that is O(n) using O(1) hashmap lookups (and using reflection,
> and not working if SecurityManage
On Tue, Aug 11, 2009 at 12:17 AM, fft1976 wrote:
> I don't know JVM too well, but I think no efficient user-level
> solution is possible. Why? To take care of substructure sharing, you
> need to remember a set of shareable values that have already been
> serialized, and do "reference equality" co
On Mon, Aug 10, 2009 at 10:57 PM, Kyle R. Burton wrote:
> On Mon, Aug 10, 2009 at 10:42 PM, Kyle R. Burton
> wrote:Sorry, forgot to offer up the inverse of freeze, thaw:
>
> (defn thaw [bytes]
> (with-open [bais (java.io.ByteArrayInputStream. bytes)
> ois (java.io.ObjectInputStream.
Java object serialization handles cycles based on object identity.
On Tue, Aug 11, 2009 at 6:17 AM, fft1976 wrote:
>
> On Aug 10, 8:19 pm, "Kyle R. Burton" wrote:
>> > Does all this work with cycles, Java arrays, etc.?
>>
>> It will work with anything that implements the Serializable interface
>
On Aug 10, 8:19 pm, "Kyle R. Burton" wrote:
> > Does all this work with cycles, Java arrays, etc.?
>
> It will work with anything that implements the Serializable interface
> in Java. Arrays do implement that interface, as do all the
> primitives. With respect to cycles, I'd suspect it does, bu
> Does all this work with cycles, Java arrays, etc.?
It will work with anything that implements the Serializable interface
in Java. Arrays do implement that interface, as do all the
primitives. With respect to cycles, I'd suspect it does, but would
test it. If you have a repl handy it should
On Aug 10, 7:57 pm, "Kyle R. Burton" wrote:
> On Mon, Aug 10, 2009 at 10:42 PM, Kyle R. Burton wrote:
> >> Is there a way to do binary serialization of Clojure/Java values?
> >> ASCII (read) and (write) are nice, but they are wasting space,
> >> truncati
On Mon, Aug 10, 2009 at 10:42 PM, Kyle R. Burton wrote:
>> Is there a way to do binary serialization of Clojure/Java values?
>> ASCII (read) and (write) are nice, but they are wasting space,
>> truncating floats and are probably slow compared to binary
>> serialization.
&
> Is there a way to do binary serialization of Clojure/Java values?
> ASCII (read) and (write) are nice, but they are wasting space,
> truncating floats and are probably slow compared to binary
> serialization.
The following utility functions have worked in many cases for me:
(defn
Is there a way to do binary serialization of Clojure/Java values?
ASCII (read) and (write) are nice, but they are wasting space,
truncating floats and are probably slow compared to binary
serialization.
--~--~-~--~~~---~--~~
You received this message because you
12 matches
Mail list logo