I wrote a test to measure the basic performance of "operator new[]". To my surprise, it came out to 3.1 usec per new/delete pair. malloc(), on the other hand, came out to 980 microseconds. How could "operator new[]" be 3.5 times slower than "malloc"? Well, it turns out that that time is almost entirely spent guaranteeing that malloc() doesn't wake up one morning and decide to throw some random exception. Specifically, if I change the declaration of "operator new" (libstdc++-3.0/libsupc++/new_op.cc) from: void * operator new (std::size_t sz) throw (std::bad_alloc) to simply void * operator new (std::size_t sz) (and likewise for "operator new[]") then performance is much better --- operator new[] performs almost indistinguishably from malloc(). I suggest fixing this by removing the "throw (std::bad_alloc)" from the definition of "operator new" and "operator new[]". I'm curious about any reaction you might have to this bug report. Please feel free to contact me at kjd@duda.org. Thanks, Kenneth Duda
This is a duplicate of PR 14563 Danny
*** This bug has been marked as a duplicate of 14563 ***