Every time when people are facing a new arrival of memory management system, some of them cannot keep from writing a simple testing program to see the performance of the new system.
We have done this testing for those who are reluctant to write testing code. The program is very simple, just create lots of garbage and let the system to reclaim them. Here is the core of testing and the time to complete 1000 loops.
| System | Source Code | Time Cost |
|---|---|---|
| C++ | ... delete [ ] new char [ n ]; ... | 1.1 ~ 1.3 ms |
| BDW GC | ... GC_MALLOC_ATOMIC ( n ); ... | 2.3 ~ 2.4 s |
| .NET CLR | ... gcnew array<char> ( n ); ... | 81 ~ 94 ms |
| HnxGC | ... gcnew char [ n ]; ... | 1.7 ~ 2.1 ms |
| HnxGC (Circular Ref) | ... gcnew char [ n ]; ... | 5.3 ~ 6.4 ms |
In this testing, the object size 'n' is 500KB. It shows that HnxGC with non-circular reference is just a little slower than manual memory management, much faster than BDW and .NET CLR. The speed of collecting circular referenced objects in HnxGC is also satisfied for us as it is about 15 times faster than .NET, and about 300~400 times faster than BDW.
download the output logs.view the source code of this testing.
case3-c++.cpp
case3-bdw.cpp
case3-clr.cpp
case3-hnx.cpp
Makefile