stdio performance in tango, stdlib, and perl

torhu fake at address.dude
Sat Mar 24 07:18:57 PDT 2007


torhu wrote:
> ---
> /* C test w/malloc and free */
> #include <stdio.h>
> #include <stdlib.h>
> 
> int main() {
> 
>     char *buf = malloc(1000);
>     while (fgets(buf, sizeof(buf), stdin)) {
>        fputs(buf, stdout);
>        free(buf);
>        buf = malloc(1000);
>     }
>     free(buf);
>     return 0;
> ---

Whoops, can anyone spot the bug?  When I fixed it, the time it took to 
run my test went down from about 23 to about 3 seconds.



More information about the Digitalmars-d mailing list