3 ms·
In what way? As far as I can tell point 1 is true memory allocation in C# is faster than in C++. Point 2 not so much unless you are starting out fresh and have
by stonemetal 17y ago
In what way? As far as I can tell point 1 is true memory allocation in C# is faster than in C++. Point 2 not so much unless you are starting out fresh and have no libraries beyond the standard library, and really how often is memory allocation really such a bottle neck that you write your own allocator? Point 3 true of pretty much every language that isn't C. Sure there are bridges to specific languages like boost.python but nothing general. Point 4 is pretty much true C++ doesn't have a strong module system. So outside of not knowing the technical term for ABI, what is really so poor about the article? I would have thought most of what he brought up was obvious and not worth the submission.
- humbledrone 17y agoThere's no way that real memory allocation is faster in C# than in C++. I don't know much about the CLR, but if it appears to allocate memory faster, it is probably because it is taking the memory from a pool which it has already allocated from the OS. You can do that in C++ if you want, using e.g. boost::pool.
- stonemetal 17y agoAs with most compacting collecting languages memory allocation is a space check and a pointer increment. In C++ new has to do quite a bit more. It is about Java but C# is capable of the same. http://www.ibm.com/developerworks/java/library/j-jtp09275.html http://www.ibm.com/developerworks/java/library/j-jtp09275.ht... Also note that C++'s memory model is "single threaded" new must grab a global lock where as C#'s memory allocator is designed with threads in mind so no locking overhead.