<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 19, 2014 at 2:35 AM, Max Leske <span dir="ltr">&lt;<a href="mailto:maxleske@gmail.com" target="_blank">maxleske@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I’ve written an implementation of lazily initialized expandable collections (for OrderedCollection and subclasses only for now), inspired by Alexandre’s talk at ESUG (<a href="http://www.youtube.com/watch?v=x0YJ2dsZdKg&amp;list=UUO-vBhaKVZf0al-ISMMPvRw" target="_blank">http://www.youtube.com/watch?v=x0YJ2dsZdKg&amp;list=UUO-vBhaKVZf0al-ISMMPvRw</a>). The implementation is pretty much straight forward but there are a couple of culprits I want to point out in case anybody else wants to do this:<br>
<br>
- my implementation requires an extra instance variable in OrderedCollection to store the requested size. This extra instance variable will break Monticello (and possibly other tools) because Monticello uses OrderedCollections to load code and the particular way it uses them makes it impossible to change the number of instance variables on OrderedCollection. Also, all .mcz files written after the change will not be loadable by images without the new instance variable (same reason).<br>
- the above means that you have to modify the code in the image manually and save a new “base image&quot;<br>
- read only messages should obviously not initialize the array. The ‘firstIndex’ and ‘lastIndex’ variables are quite handy for that. I initialize those variables to 1 and 0 respectively which makes most things work already (e.g. #size, #isEmpty etc.).<br>
- when trying to implement the same for HashedCollection I couldn’t. The image didn’t just stop working, there was no output at all on the console, not even when using a debug VM. The problem seems to be MethodDictionary, at least that’s the only subclass of Dictionary for which adding an instance variable doesn’t work.<br></blockquote><div><br></div><div>Yes, alas the shape of MethodDIctionary is baked into the VM&#39;s method lookup code.  It would be straight-forward to fix it, but it is still work and one would have to wait for people to update their VMs.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I’ll share some memory monitoring as soon as I have something significant (only just rolled it out).<br>
<br>
<br>
Big thanks to Alex for his talk and the cool work he and his students did!<br>
<br>
Cheers,<br>
Max<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>