Re: Object Euphoria optimiztion

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

Mike Nelson wrote:

> Some advice about optimiztions for speed:
> 1.  Minimize type checking--particularly avoid rechecking the same
>     data when possible.
> 2.  Avoid nested procedure calls--inline simple routine code.
> 3.  Similarly, avoid recursion.
> 4.  It is much faster to search sevaral short sequences than one
>     huge sequence.
> 5.  Use variables to reduce repetitive subscripting.


Just a few comments.

I am in complete agreement with you on points 1 and 5. In fact I have
always maintained, rightly or wrongly, type checking is nothing more
than a debugging tool of dubious value.

I think your second point is probably not terribly important. Routine
calls are incredibly cheap in Euphoria, in comparison with just about
any language I know. So unless you are dealing with very short
innermost loops of millions of cycles, it's not worth the trouble
trying to unroll them.

And similarly, your advice against recursion is marginal. Once again,
recursive calls in Euphoria are very efficient, and it's generally
very difficult to find faster alternatives to well designed, tight
recursive routines.

Finally, I have never seen any evidence for your claim under number 4.
I have tested the speed of find() many times, and it seems to be
simply linear with the traversed length. Chopping up sequences just
simply adds to overheads.

jiri

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

Search



Quick Links

User menu

Not signed in.

Misc Menu