Re: Speed

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

I had a rude shock when I wrote my eBasic converter. After reading the
benchmarks included with Euphoria, I was under the impression that Euphoria
ran signifigantly faster than interpreted QBasic. As a result, I thought
that a program that converting QBasic programs to Euphroia would result in
great speed-up in the code.

Imagine my suprise when I converted the QBasic benchmarks to discover that
the Euphoria version of the code ran about the *same* speed, or often much
slower!

You can look in the eBasic documentation for more details, but most of the
benchmarks gained their speed increase because they called specialize
Euphoria routines, so the comparisons were essentially apples vs. oranges -
stacked in Euphoria's favor. For example:

- Array initialization using a FOR...NEXT loop was replaced with repeat().
- Adding two arrays using a FOR...NEXT loop was replaced with adding two
sequences.
- String concatonation using MID$ and LEN used an optimized append() call.
- Name lookup using a FOR...NEXT loop was replaces with a find().

So the benchmarks demonstrated that using Euphoria's specialized routines
were faster than coding them by hand. No suprise there.

What I found perhaps most misleading was the string concatonation. For
example, the code that eBasic generated for:

   S$ = S$ + "*"

was:

   gStr[1] = gStr[1] & "*"

A fairly innocuous bit of code, yielding a score of 4089 operations, three
times SLOWER than QBasic's 13,880 operations. After scratching my head for
a while, I found that changing the code to:

   gStr = gStr & "*"

bounced Euphoria's score to an stellar 778,333! Clearly, an optimized
operation - and an atypical.

Euphoria's IS a fast language - but I'm not sure that, in a comparable
test, that it is faster than integer-based QBasic, or PowerBasic.

-- David Cuny

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

Search



Quick Links

User menu

Not signed in.

Misc Menu