[Haskell-cafe] #haskell works

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat Dec 15 15:19:14 EST 2007


Hello Don,

Saturday, December 15, 2007, 10:57:02 PM, you wrote:

> Do you have the single loop C program, btw? I'd be curious to see if
> this is really "feasible". It would have to do the buffering, tokenising
> and accumulating in one go. I'd imagine it is a bit hairy.

for (int n; n = read (0, buf, 32768);) {
  for (char *p=buf,*end=buf+n;;)
    while (*p++==' ') if(p==end) goto end;
    while (*p++!=' ') if(p==end) goto end;
    words++;
  }
  end:;
}

> And, it should not significantly outperform, say, a bytestring version.
> If it does, I'd like to see that.

you are welcome :)

OPT_FLAGS   = -O3 -march=pentiumpro -mtune=pentiumpro \
              -fomit-frame-pointer -fstrict-aliasing \
              -ffast-math -fforce-addr -funroll-loops \
              -fno-exceptions -fno-rtti


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list