Re: LuaJIT SHA1

  • From: Chris <chris@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 20 Jun 2012 17:05:43 -0400

On 06/18/2012 10:28 AM, William Adams wrote:
Looking at the sha1 code briefly, I'm sure you could speed things up
significantly with
a few small changes.

Probably the biggest thing you could do is implement based
on a straight buffer instead of relying on Lua strings in any way.

Thanks. Yes I had the same thought when I originally wrote the module and I did use C buffers at first. I then tested against using regular strings and there was no measurable difference in performance.

Most of the CPU time is spent doing the actual SHA1 calculation and the string stuff is only a tiny fraction of time. So I stuck with the plain Lua strings because it made the code and interface simpler.

--
Chris   http://luadev.com

Other related posts: