Ara.T.Howard wrote:

> here's some things i think of:

<lots of good stuff deleted>

>    - anchor every single regular expression : performance degrades
>      exponentially otherwise

That's not possible - especially with String#scan.  Sometimes you want all
occurrences of something.

>    - compile regular expressions only once unless they require
>      variable substitution

I guess you're talking about flag /o or storage of a regexp object
somewhere which is really only needed if the regexp contains interpolation
that you want to do only once.  Otherwise a regexp *is* compiled only once
and inline regexps are roughly as performant as a stored regexp and might
be easier to read (not always).

>    - cache anything possible, for instance methods dynamically
>      generated from method_missing : permanmently add the method to
>      the object instead of generating it everytime
>
>
> now, i'm not saying these are 'right' - just that they are what i
> think of when trying to make ruby fast.

In fact I agree with most of what you wrote. :-)

Kind regards

    robert