A simplistic adaptation of Hans Boehm's GCBench, which in turn was adapted from a benchmark by John Ellis and Pete Kovac.
Thanks to Christophe Troestler and Einar Karttunen for help with this benchmark.
Use default GC, use per node allocation or use a library memory pool.
As a practical matter, the myriad ways to tune GC will not be accepted.
As a practical matter, the myriad ways to custom allocate memory will not be accepted.
Please don't implement your own custom "arena" or "memory pool" or "free list" - they will not be accepted.
The work is to create binary trees - composed only of tree nodes all the way down-to depth 0, before any of those nodes are GC'd - using at-minimum the number of allocations of Jeremy Zerfas's C program. Don't optimize away the work.
How to implement
We ask that contributed programs not only give the correct result, but also use the same algorithm to calculate that result.
Each program should:
define a tree node class and methods, a tree node record and procedures, or an algebraic data type and functions, or…
allocate a binary tree to 'stretch' memory, check it exists, and deallocate it
allocate a long-lived binary tree which will live-on while other trees are allocated and deallocated
allocate, walk, and deallocate many bottom-up binary trees
allocate a tree
walk the tree nodes, checksum the node items (and maybe deallocate the node)
deallocate the tree
check that the long-lived binary tree still exists
diff program output N = 10 with this 1KB output file to check your program output has the correct format, before you contribute your program.
Use a larger command line argument (20) to check program performance.