Quoting demerphq <demerphq@gmail.com> from ml.lang.perl.porters: :2009/10/30 Raphael Manfredi <Raphael_Manfredi@pobox.com>: :> In the end, the speed difference between JSON::XS and Storable is going :> to be that extra hash table lookup used to remember objects so that :> references be kept properly (shared objects remaining shared accross a :> serialization and deserialization). : :It is not just a lookup tho, it is also a store right? IMO that is :where a DAG serializer wins. That's right. You have to traverse the structure you're serializing in any case, and store objects as you reach them. In a direct acyclic graph case, you know you won't be traversing the same object twice, so you do not have to ask yourself questions and you blindly serialize as you go. When you can have cycles in your graph, you need to remember the objects you traverse so that if you reach them again through another path, you can just leave a pointer to the already serialized object and not redo the serialization again for that object. So I was actually wrong in claiming the only cost would be a single lookup. It's really a lookup plus a store in the table for each object, like you have correctly pointed out. And storing data means dynamic memory allocation, always a costly operation (somewhat), and surely more costly than a pure table lookup. RaphaelThread Previous | Thread Next