wc

Stephen Weeks sweeks@wasabi.epr.com
Fri, 13 Aug 1999 15:55:05 -0700 (PDT)


> SML/NJ.  I'm still running 110.9.1, but a  simple  version  of  wc  does  the
> following:
> 
>         Native C: .04 seconds
>         MLton:    .34 seconds
>         SML/NJ:   .48 seconds
> 
> Mind  you,  I  did  use  the  TextIO.input  procedure.   When  I  switched to
> TextIO.input1 the times became:
> 
>         SML/NJ:  1.15 seconds
>         MLton:    .25 seconds

Still, embarrassing that MLton is 6x slower than C.  Wait, are you
comparing to wc code you wrote in C?

> I guess that SML/NJ sped up because it didn't have to  allocate  the  string?
> Seems a bit weird.

I assume you mean MLton sped up?  Assuming so, yes, with input1 MLton
doesn't have to allocate anything, it just returns a character from
the buffer and bumps a counter.