lua-users home
lua-l archive

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


--- SATO Seichi <seichi@air.ne.jp> wrote:
> Eric, thank you for your reply.
> But your gsub approach is slower than concatenation.
> 
> this is I wrote:
> 
>   function bytetostring (bytes)
>     local buf = strrep(' ', getn(bytes))
>     local index = {n = 0}
>     local rep = function (c)
>                   %index.n = %index.n + 1
>                   return strchar(%bytes[%index.n])
>                 end
>     return gsub(buf, '(.)', rep)
>   end

Well, in Lua 4.1w4 it's nearly 10 times faster than concatenation.

I'm surpised it's so much slower in Lua 4.

Cheers,
Eric

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/