[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua and pointers
- From: David Given <dg@...>
- Date: Mon, 20 Nov 2006 16:57:09 +0000
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.
You may find the metatable trick is plenty fast enough --- if you really are
doing time-critical processing, then you won't be able to tell for sure until
you measure it. Intuition is frequently wrong.
That said, you may find this idiom useful:
local string_gsub = string.gsub
a = string_gsub(s, p, r)
It saves two table lookups per call.
> PS: I have auto-wrapping set at 70 characters, which kicks in when writing
> a mail and I never noticed the mails arriving unwrapped on the list until
> mentioned. I'll check my settings.
Still not working, I'm afraid.
╭─┈David Given┈──McQ─╮ "A line dancer near a graduated cylinder, the
│┈ email@example.com┈┈┈┈│ blithe spirit inside some wheelbarrow, and a tomato
│┈(firstname.lastname@example.org)┈│ are what made America great!" --- received via spam
Description: OpenPGP digital signature