kikito / md5.lua

MD5 sum in pure Lua, with no C and no external dependencies
MIT License
326 stars 151 forks source link

Improved ffi support for LuaJIT, +269% perf boost #19

Closed ExtReMLapin closed 2 years ago

ExtReMLapin commented 4 years ago

43350% performance boost on lei2str

Didn't benchmark str2lei but it's also faster

Edit:

after all the optimizations done here, it's a

tst2005 commented 4 years ago

Hello If i'm not wrong your changes introduce "ffi" as mandatory required. But md5.lua is supposed to be run with or without "ffi" : PUC/Rio LUA don't have "ffi". Please consider the case of "ffi" not available : fallback to a code without "ffi". Regards,

ExtReMLapin commented 4 years ago

yes, my bad, I forgot to push the very last version of my edits, it's now fixed

ExtReMLapin commented 4 years ago

As a performance PoV it would be probably better to define the function inside the condition and not have the condition inside the function, but whatever.

ExtReMLapin commented 4 years ago

200% perf boost from 880eaf24c408e2f1ec6102f7d09bdef5ad821069 to e5d472f8d5fc521cdded700686f3a148bc3bdd14

pablomayobre commented 4 years ago

This is really good, I'd approve this change!

ExtReMLapin commented 4 years ago

There is a luajit only compatible md5 here, which is only if using the optimizations I pushed on it, also faster than this version with the luajit optimizations (28% faster)

kikito commented 2 years ago

Thanks for this, I have merged it. Apologies for the time it took me to do it.