Re: Faster lower() command
Hi didn't run any test but I'm surprised that a for loop written in euphoria is
faster than a loop internal to the interpreter!
Jesse Adkins wrote:
>
> jacques deschĂȘnes wrote:
> >
> > here is the power of euphoria
> >
> > }}}
<eucode>
> > function lower(object o)
> > return o + (o>='A' and o<='Z')*32 -- work as well with atom or sequence
> > end function
> > </eucode>
{{{
> >
> >
> > regards,
> > Jacques D.
>
> I'm well aware of that command, since it's what's in place already. The
> command that I put up for display processes a sequence much faster than the
> current code for lower(). A test I ran, with all letters in caps, ran about
>
> twice as fast as the current code.
>
> I kept the original code for doing atoms, since the guru.ex code doesn't work
> so well with atoms for some reason
>
> I'm hoping the code I posted earlier could become part of Euphoria some day,
>
> despite the fact that it's a good deal larger than the current lower()
> command.
>
> -- Jesse Adkins.
|
Not Categorized, Please Help
|
|