On Apr 16, 2007, at 8:46 AM, Andy Dougherty wrote:
On Sun, 15 Apr 2007, Allison Randal via RT wrote:According to our records, your request regarding "[TODO] ResizableBooleanArray uses 64 bytes per bit of information" has been resolved.If you have any further questions or concerns, please respond to this message.For other topics, please create a new ticket.<URL: http://rt.perl.org/rt3/Ticket/Display.html?id=39063 >Are you *sure* it's been fixed? My test involved running a simple program something like this .sub _main .local pmc pmc1 pmc1 = new ResizableBooleanArray pmc1[1000] = 1 .end and incrementing the '1000'. I found that for every element I added,parrot allocated 64 extra bytes. (I monitored parrot's calls to malloc()with -DDETAIL_MEMORY_DEBUG.) Hence if I want to store 1,000 bits, parrot will call malloc() to allocate 64,000 bytes. That's why I said it "uses 64 bytes per bit of information". I apologize in advance if I have misunderstood the correct way to use ResizableBooleanArray or what the number '1000' means in the above example. -- Andy Dougherty [EMAIL PROTECTED]
Well using this script I seem to improve the results greatly... Using freeze is ugly and not best but the only way I could think of the really get the size of the pmc(especially since a pmc could compress it's data).
.sub _main .local pmc pmc1 pmc1 = new .ResizableBooleanArray pmc1 = 100000 $S0 = freeze pmc1 $I0 = length $S0 $S0 = $I0 say $S0 pmc1[1000000] = 1 $S0 = freeze pmc1 $I0 = length $S0 $S0 = $I0 say $S0 .endI get 6400136 and 64000136 before, and 100080 and 1000080 now. But before applying this patch(which passes it's tests, and one unexpectedly), I'd probably recommend improving the testing suite.
rba.patch
Description: Binary data