Reputation: 17345
I have noticed that loading this file
https://raw.githubusercontent.com/kikito/sha1.lua/f607d523c133c08ab8e35cc6507e81273bb80053/sha1.lua
is very slow (using Lua 5.1).
#!/opt/homebrew/bin/lua
require("sha1")
print("Hello")
running this gives:
$ time ./test.lua
Hello
real 0m0.774s
user 0m0.760s
sys 0m0.012s
When removing the require()
line, it gets down dramatically:
$ time ./test.lua
Hello
real 0m0.006s
user 0m0.002s
sys 0m0.003s
Which part is taking so long for the file to load?
Upvotes: 1
Views: 275
Reputation: 249394
It says right in the file:
-- loading this file (takes a while but grants a boost of factor 13)
local PRELOAD_CACHE = true
Set that to false and it will load faster but run slower.
Upvotes: 4