fpizlo at apple.com
Mon Feb 6 12:45:40 PST 2012
> I have been trying to optimize or somehow control the invocation of the Java Script Core's Garbage Collector by changing certain values like the highWaterMark and minBytesPerCycle of Heap.cpp. By default the value of minBytesPerCycle is 512 KB, but when i change it to 2 MB i found some performance gain in SunSpider.
> For x86 the gain is about 300 ms
> For ARM(embedded) core getting around 150 ms.
You will notice that minBytesPerCycle is already set differently on different platforms precisely because of these time-space trade-offs. The Heap::Heap constructor sets it to heapSizeForHint(), which will often return something like 16MB or 8MB. If you find that you'd prefer to have finer-grained control, feel free to submit a patch that rationalizes this code to your needs.
> Is there any side affect with the changes i have made with minBytesPerCycle from 512KB to 2 MB?
As Geoff already pointed out, you are making an instance of the GC always use a minimum of 2MB of memory in steady state even if the application is not using that much.
> Is there any other i can optimize the performance or control the invocation of GC?
I recommend Steve Blackburn's papers on GC for Java as a good starting point, as those collectors are generally regarded as having the best balance of throughput, space usage, and architectural simplicity:
http://www.hpl.hp.com/personal/Hans_Boehm/gc/#details and http://www.hpl.hp.com/personal/Hans_Boehm/gc/#further
And finally consider getting the new GC book by Hosking et al:
More information about the webkit-dev