perf.html example — Garbage Collection With Merge Sort

This example runs two different implementations of the merge sort algorithm. The first button runs an implementation that creates lots of small arrays. All of these small arrays must be cleaned up. The second implementation pre-allocates a single array, and operates within two arrays. It avoids the problem of making the garbage collector work too hard.

Original demo by Greg Tatum