Adding Java and C++ to the MQTT benchmarks or: How I Learned to Stop Worrying and Love the Garbage Collector

Walter Bright newshound2 at digitalmars.com
Wed Jan 8 19:08:03 PST 2014


On 1/8/2014 12:23 PM, Benjamin Thaut wrote:
> Additionaly programming with a GC often leads to a lot more allocations,

I believe that this is incorrect. Using GC leads to fewer allocations, because 
you do not have to make extra copies just so it's clear who owns the allocations.

For example, if you've got an array of char* pointers, in D some can be GC 
allocated, some can be malloc'd, some can be slices, some can be pointers to 
string literals. In C/C++, the array has to decide on an ownership policy, and 
all elements must conform.

This means extra copies.


More information about the Digitalmars-d mailing list