February 26, 2004
Hi,

I just heard about D, and thought I'd give it a try.
I ran the wc D program found here:
http://www.digitalmars.com/d/wc.html
on a 196MB file on linux.

I got the numbers output to me in about 3 seconds,
however I had to wait 6 more *minutes* before the
program ended.  The resident size of the program
was about 188MB.

This contrasts with /usr/bin/wc which ran in about
3 seconds and used 300KB of memory.

Anyways, it looks like D is trying to do garbage collection
at the end of the program when it doesn't need to... it
can just exit.  Also, the 6 minutes seems a bit long.

thanks,
-joe



February 26, 2004
joe@vpop.net wrote:
> Hi,
> 
> I just heard about D, and thought I'd give it a try.
> I ran the wc D program found here:
> http://www.digitalmars.com/d/wc.html
> on a 196MB file on linux.
> 
> I got the numbers output to me in about 3 seconds,
> however I had to wait 6 more *minutes* before the
> program ended.  The resident size of the program
> was about 188MB.

I think the wc example was a bit simplified because it was an example. std.file.read will read the entire file into a memory buffer.  This isn't most efficient approach with a 196MB file.  This would also explain why the memory footprint of the program was almost the same as the file size.  A more efficient approach would be to use std.stream. You could try to adapt the program as an exercise :)

> Anyways, it looks like D is trying to do garbage collection
> at the end of the program when it doesn't need to... it
> can just exit.  Also, the 6 minutes seems a bit long.

Agreed.


Sean