I was curious to see if new DMD had changed speed on Maxime
Chevalier-Boisvert's allocation benchmark here:
http://pointersgonewild.com/2014/10/26/circumventing-the-d-garbage-collector/
I haven't had time to look at the Phobos test suite to know if
this was one of those that were included, but the difference
seems to be striking. I am using two machines in my office -
both of which are old x64 boxes running Arch Linux and are quite
old (8 Gb RAM only). Same manufacturer and similar models so
should be same spec CPUwise. Have not got time to install and
compare different versions of dmd on same machine, so fwiw:
1mm objects
-----------
dmd 2.07 release: 0.56 seconds
dmd 2.067-devel-639bcaa: 0.88 seconds
------------
dmd 2.07 release: between 4.44 and 6.57 seconds
dmd 2.067-devel-639bcaa: 90 seconds
In case I made a typo in code:
import std.conv;
class Node
{
Node next;
size_t a,b,c,d;
}
void main(string[] args)
{
auto numNodes=to!size_t(args[1]);
Node head=null;
for(size_t i=0;i<numNodes;i++)
{
auto n=new Node();
n.next=head;
head=n;
}
}