<br><br><div class="gmail_quote">On Wed, May 6, 2009 at 12:49 PM, Zulq Alam <span dir="ltr">&lt;<a href="mailto:me@zulq.net">me@zulq.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
When deserializing Dictionary objects, it looks like they are being rehashed. Where and why is this happening?</blockquote><div><br></div><div>I&#39;m sorry I don&#39;t know where, but the why is because a deserialized Dictionary (or Set, or any hashed collection) will, if non-empty, contain newly created/deserialized objects whose identity hashes will differ from those of the serialized ones.  Since Object&gt;&gt;#= defaults to #== and Object&gt;&gt;#hash defaults to #identityHash an equality-hashed collection still needs to be rehashed when deserialized since #= hashes can depend on identityHash.</div>
<div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">dict1 := Dictionary new.<br>
1 to: 1000 do: [:e | dict1 at: e put: e].<br>
<br>
rep1 := ReferenceStream streamedRepresentationOf: dict1.<br>
dict2 := ReferenceStream unStream: rep1.<br>
rep2 := ReferenceStream streamedRepresentationOf: dict2.<br>
<br>
dict1 = dict2. &quot; true &quot;<br>
rep1 = rep2. &quot; false &quot;<br>
<br>
dict1 array size. &quot; 2560 &quot;<br>
dict2 array size. &quot; 1334 &quot;<br>
<br>
dict1 rehash.<br>
dict1 array size. &quot; 1334 &quot;<br>
<br>
<br>
I&#39;m using ReferenceStreams to store object graphs in a relational database as a BLOB using Glorp. Glorp determines whether to do an updated by comparing the serialized form of objects with their last state. This causes spurious UPDATEs.<br>

<br>
Any ideas?<br>
<br>
Thanks.<br><font color="#888888">
Zulq.<br>
<br>
<br>
</font></blockquote></div><br>