lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Mar 24, 2012 at 5:19 PM, Roberto Ierusalimschy <roberto@inf.puc-
> Do you know the value of LUA_MAXSHORTLEN for those tests?

Default makefiles are used.  32 bytes on x86.

A better test may be running the LuaDist module repo through squish
(based on LuaSrcDiet).  Results and test code are below:

-- gcc 4.5.3 x86, Xeon
5.1.5: 14.6 14.3 14.5 s
5.2.0: 14.0 13.8 13.9 s
5.2.1-work1 16 bytes: 13.9 13.7 14.0 s
5.2.1-work1 32 bytes: 13.9 14.1 13.8 s
5.2.1-work1 128 bytes: 13.6 14.0 14.2 s
LuaJIT 2.0.0-beta9: 6.7 6.7 6.7 s

-----
-- test.lua
-- Before running this do
-- $ git clone git://github.com/LuaDist/Repository.git
-- $ (cd Repository && git submodule update --init)
-- $ find Repository/ -name '*.lua' > all.txt

local FS = require 'file_slurp' -- https://gist.github.com/1325400
--local LB = require 'luabalanced'

-- squish http://matthewwild.co.uk/projects/squish/home
package.path = package.path .. ';squish-0.2.0/minify/?.lua'
opts = {minify=false}
dofile 'squish-0.2.0/minify/squish.minify.lua'
-- note: patch 0.2.0 by replacing all base.getfenv() with _M.

-- Load texts into memory (approx 1.5 seconds).
local texts = {}
for name in FS.readfile'all.txt':gmatch'[^\r\n]+' do
  texts[#texts+1] = FS.readfile(name)
end

for i,text in ipairs(texts) do
  local ok, err = pcall(function() text = minify_string(text) end)
  --local ok, err = pcall(function() LB.gsub(text, function(c,s) end) end)
  -- print(ok)
end
-----

I also checked ModuleCompressDeflateLua (which operates on strings one
byte at a time during DEFLATE decompression) and saw no difference in
5.2.1-work1.