Re: Eu Interpreted

new topic     » goto parent     » topic index » view thread      » older message » newer message

I agree with you, Mike, Irv's test is a mere comparison of upper()
functions. But on the other hand it highlights the fact that
important, widely used functions like lower() and upper() should be
optimised built-in routines, not just high level euphoria stuff -
that's simply crazy no matter how 'elegant' the code is.

jiri

----- Original Message -----
From: "Mike" <vulcan at win.co.nz>
To: "EUforum" <EUforum at topica.com>
Subject: RE: Eu Interpreted


>
> Hi Irv,
>
> -- It seems to me that this latest test merely reduces to a
comparison
> of upper().
> -- Does lua act directly on the sequence like C? If so then a more
> suitable comparison
> -- would be to inline the upper() function in the EU code. Try using
> this one noted below
> -- instead of Rob's "elegant" routine in wildcard.e
> -- It should speed up the Eu code by a factor of 2
>
> -- In any case, whatever criticsms may be made when comparing:
>
> " a generic and *interpreted* shell-sort written in Euphoria,
> against a quick-sort routine *written in compiled C* "
>
> -- surely also apply in the case of strupper vs upper, do they not?
>
> Your truly
> Mike
>
> vulcan at win.co.nz
>
> function faster_upper(sequence d)
> integer c, disp
> disp='a'-'A'
> for j=1 to length(d) do
> c=d[j]
> if c>='a' then
> if c<='z' then
> d[j] -= disp
> end if
> end if
> end for
> return d
> end function
>
> Irv Mullins wrote:
> > On Tuesday 14 August 2001 12:50, Robert Craig wrote:
> > >
> > > Irv Mullins writes:
> > > > Reading a 10,500 line text file and sorting it100 times in
Euphoria
> > > > takes
> > > > 9.38 seconds, the same task in Lua takes 9.61 seconds. Making
the sort
> > > > call via "dostring" instead of direct takes 9.62 seconds.
> > >
> > > Correct me if I'm wrong but this benchmark
> > > seems to consist of:
> > >
> > >   1. doing a bunch of I/O, where a large chunk of the time
> > >        will be spent inside the O/S, and also waiting for
possible
> > >        mechanical motion of the disk. Interpreter speed is
largely
> > >        irrelevant. The I/O time just dilutes the overall speed
comparison.
> > >
> > >   2. sorting, where you compare a generic and *interpreted*
shell-sort
> > >       written in Euphoria, against a quick-sort routine *written
in
> > > compiled C*, i.e. the Lua *built-in function* for "sort".
> > >       In any case, for 10,500 items, the quick sort *algorithm*
should be
> > >       somewhat faster than shell sort.
> > >
> > > The fact that Euphoria wins the benchmark is remarkable.
> >
> > It certainly is. But, as you say, the disk access masks the
differences.
> > Once you take the disk access time away, the story is different.
> > Look at this one:
> >
> > Convert 10,564 lines of text (from listserver archive) to
uppercase:
> > (Timing starts after text is loaded)
> >
> > Euphoria :  0.24 seconds
> > Lua:          0.02 seconds
> >
> > -------------------
> > -- Filesort.lua
> > -------------------
> >
> > lines = {}
> >
> > readfrom("lua.txt")
> > lines = read("*all")
> > readfrom()
> >
> > start = clock()
> > lines = strupper(lines)
> > fini = clock()
> >
> > print(lines) -- to verify all is upper case
> > print(format("%2.4f",fini-start))
> >
> > --------------------
> > -- Filesort.exu
> > --------------------
> > include wildcard.e
> >
> > atom fn, start, fini
> > sequence text
> > object line
> >
> > fn = open("lua.txt","r")
> > text = {}
> > while 1 do
> >   line = gets(fn)
> >   if atom(line) then exit
> >   else text = append(text,line)
> >   end if
> > end while
> >
> > start = time()
> > text = upper(text)
> > fini = time()
> >
> > printf(1,"Time required: %2.4f",fini-start)
> >
> > Regards,
> > Irv
> >
> >
> >
>
>
>
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu