William Adams wrote: > 1) Would I be better off doing a cast of 's' in the beginning, > and then using simple array access after that? Any great > advantage over just doing the getbytes? My assumption is it > would be faster, but I don't know of other tradeoffs. It should be slightly faster. Not all range checks can be eliminated for string.byte(). > 2) Should I switch the Digest.consts table to being an array of > in32_t instead of a Lua table? Will it be more efficient in > some way, or some other benefit? It avoids bounds checks, type checks and plenty of double -> int conversions (in single-number mode, default on x86/x64). So yes, it would make a difference. BTW: string.len(s) is compatibility from Lua 5.0. Better use #s. BTW#2: Try -jdump on a sample snippet only testing this code. Even if you don't know much about assembler, you can still judge the length of the machine code inside the 'LOOP'. Shorter is better, less branches and less loads/stores are better. Beware: it's addictive to stare at compiler output. :-) --Mike