gc vs explicit

zz zz at zz.com
Fri Dec 8 01:53:37 PST 2006


Dave wrote:
> zz wrote:
> 
>> Walter Bright wrote:
>>
>>> zz wrote:
>>>
>>>>  From my point of view these tests are not really nessesary on my 
>>>> side since I still continue using D and I belive that someday the 
>>>> memory stuff will be optimized.
>>>
>>>
>>>
>>> One thing that is happening is that the C++ code allocates memory, it 
>>> never frees it. The same with the D code.
>>
>>
>> Not until it's out of scope (in this case main).
>>
> 
> With that in mind, I wrapped your original code in a loop for 10 
> iterations and decreased the inner loop to 100000.
> 
> C++ (NedAlloc):
> Total Element count: 1000000
> 5.438000
> 
> D:
> Total Element count: 1000000
> 1.360000
> 
Cant' argue with that:
In this case D is faster I get:
C++ NedAlloc = 2.859
D = 1.421

But if you leave the original count and put in the outer loop for 10, 
D's performance becomes really bad.

c++ (NedMalloc) = 00:26.796
D = 02:23.375

> Quote: "While he liked that language and said the he might actually use 
> it to prototype idea's, he will not use it in production code due to the 
> performance."
> 
> That sounds like me two years ago (and D hasn't gotten all that much 
> faster since then) <g>

Sill uses D to prototype idea's, but this was someone else who is new.

> Don't take this as some sort of attack -- you bring up some very good 
> points. And I agree that the GC performance should be looked at (and 
> that great performance is critical), but I'm wondering if D is getting a 
> fair shake in your shop?

On my side I've used it in small stuff that is running at clients sites, 
We handle a lot of data that comes from mainframes and AS/400 and it you 
need to process the text reports from those platforms a lot of string 
processing needs to be done, in one case I recall we needed to convert 
the data (over 1 gig of raw data) into XML and I was asked by my boss to 
see how we can get it done and who should write it, I one sitting I did 
a prototype in D and that was what was sent to the client (I don't think 
it could have been done faster), for this case and some others we never 
looked at performance since:
a) the client was happy just to get something.
b) most but not all large jobs involving processing are run overnight.

While it's only 2 of us who use D from time to time, there is a lot of 
respect for D at work but sometimes people put you to the test with 1 to 
1 examples and from there they might make their desicions on whether to 
use D or not.

> Even if you had to spend 10% development time to hoist some allocations 
> out of loops with D, if you save 20% developing the first-cut you'll end 
> up better off ;)

Yes, but this was a 1 to 1 test more on the line my gun is bigger than 
yours.

Zz



More information about the Digitalmars-d mailing list