Archive for category Source Code

JSON encoder and decoder for Lua

My implementation of JSON using the LPeg library.

[Download the JSON module]

Porter stemming algorithm in Lua

This is an implementation of the Porter stemming algorithm in Lua.  It uses the LPeg library.

[Download the stem module]

SHA1 implemented in Lua

This is a SHA1 implementation for LuaJIT. Take a look at the source for example usage and documentation.

The performance is decent considering this is written in a scripting language but I appreciate any ideas for improving the speed (loop unrolling?). In my benchmarks this version appears to be around 3.6 times slower than the OpenSSL assembly language version on my Q9550 (tested in Linux; hashing about 2GB of data).

[Download Lua SHA1 source]

The benchmark script I use just reads from stdin and prints out the SHA1 hash. I generally only use the 32-bit version of LuaJIT due to its greater memory capacity.

[Download SHA1 benchmark script]

Tags: , , , ,