Early simulation of efficiently arranging data

15 views
Skip to first unread message

Ian Clarke

unread,
Dec 2, 2009, 12:40:48 AM12/2/09
to swarm-...@googlegroups.com
So I hacked together a quick simulator of a system which tries to arrange data to minimize "long" references (ie. references to objects that are distant from the current object).

You can find the (horrible horrible) code here:

  http://github.com/sanity/swarm-sim

It implements the algorithm described here:


Here is an example run:


In this run, there are 16 "memory locations", each of which can contain pointers to other memory locations.  The first line shows the number 10, which indicates that there are 10 references which cross between locations 0-7 and locations 8-15.  Then it shows the 16 locations and the pointers each contains.  

So far the initial configuration is created very naively.  The code tries to start with a configuration where most references are to close-by memory locations, but occasionally there is a long reference, since this should mirror an allocation scheme that seeks to achieve this.

The next few lines show the algorithm doing its thing, swapping memory locations.

Again, this code is messy, and probably buggy (eg. line 9 should start with '9' now but it doesn't).  I just wanted to push it out there so others could see what I'm up to.

Ian.

-- 
Ian Clarke
CEO, Uprizer Labs
Email: i...@uprizer.com
Ph: +1 512 422 3588
Reply all
Reply to author
Forward
0 new messages