lua-users home
lua-l archive

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


Hello,
profiling my application, the big bottleneck of it comes from this function:

function string2hex(str)
assert(str,"String2hex got null argument")
local h,s =  string.gsub(str, "(.)", function(c) return string.format("%02X", string.byte(c)) end) 
return h
end


The size of input strings can be from 1kb to 1Mb.
How would you optimize it ? 


thanks for any suggestion,
valerio