C
Chris M. Thomasson
Thomas J. Gritzan said:It's a bit unfair to compare one algorithm in one language and another
algo in another language. You can find a test program that shows that
whatever you want is better than whatever you want.
To make it a little bit more fair, you could run the Java GC the same
time you flush the region allocator in C++:
http://pastebin.com/m40d757b7
Okay. Sadly, it still hits a heap exception on my old platform; it just
takes longer to. When I change the line `create_tree(22);' to
`create_tree(15);' it works, but its a lot slower than the version without
explicit triggering of GC. The version without gets:
Java:
________________________________________
Time: 450 ms
with:
Java:
________________________________________
Time: 1653 ms
Compared to
C++ (MSVC 2005):
________________________________________
Time: 64 ms
C++ (MINGW):
________________________________________
Time: 216 ms
By the way, how is your region allocator different from the pool
allocator in boost?
I guess it would be more similar to:
http://www.boost.org/doc/libs/1_37_0/libs/pool/doc/interfaces/object_pool.html
However, it seems like Boost pool is using a Reaps algorithm described here:
http://www.cs.umass.edu/~emery/pubs/berger-oopsla2002.pdf
which combines region and heap allocation. Anyway, the similarity is my
region allocation can destroy all object in single call, so can Boost
object_pool. The difference is that Boost object_pool seems to be able to
allow one to destroy individual objects, my region allocator as-is simply
cannot do this. I am in the process of tinkering around with the design to
see if I can indeed pull this off.