lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


David Given wrote:
Theodor-Iulian Ciobanu wrote:
[...]
From what I understand, this was in previous versions and has been removed.
I had no idea of that. I'll stick with gsub then, as using metatables would
slow me down a bit (more code around the gsub call).

Remember the two rules of optimising your code:

1. Do not optimise your code.
2. (for experts only) Do not optimise your code yet.

I don't remember if it was Fred Brooks or PJ Plaugher or Robert Pike
that said:

  Make it work - then make it fast

Another thing that I know Plaugher wrote in his seminal work Programming
Pearl, is that before you optimize, instrument your code so that you
can measure improvements and at the same time determine exactly where
the bottleneck is.

Sometimes the slow part of your code is in unexpected places.



Ralph