[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Accessing String contents
- From: Romulo <romuloab@...>
- Date: Thu, 21 Jun 2012 10:42:31 -0300
2012/6/21 Michal Kottman <k0mpjut0r@gmail.com>:
> getmetatable("").__index = function(s, i)
> if type(i) == "number" then
> return string.sub(s, i, i)
> else
> return string[i]
> end
> end
If I put string, sub and type in locals, the performance on my machine
was noticeably better. Without locals: 5.6, with locals: 4.06. Of
course, LuaJIT ran within 0.01 seconds (my os.time() has very low
resolution)
--rb