Re: Luajit string split much much slower that Lua string split

  • From: Leo Razoumov <slonik.az@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sun, 27 May 2012 10:27:37 -0400

On Sat, May 26, 2012 at 6:53 PM, Robert McLay <rtmclay@xxxxxxxxx> wrote:
>
> I have attached a complete example that takes a file and just counts lines.
>  On my system with a file that has 250K lines and is 11MB big  (Times in
> seconds)
>
>            lua             luajit
>  read    0.0538       0.0588
>  split     0.693       17.34
>
> Thanks,

Hmm... I tried your example and I see a different behavior.

For stock Lua-5.1.5:
time lua readMtx.lua bigfile
lines:  2097153
read    0.2915461063385
split   3.9440140724182
lua readMtx.lua bigfile  4.10s user 0.14s system 100% cpu 4.246 total

For LuaJIT latest GIT master [10b9ed37e0f]
time ./luajit-2.0/src/luajit readMtx.lua bigfile
lines:  2097153
read    0.20401906967163
split   1.3892159461975
./luajit-2.0/src/luajit readMtx.lua bigfile  1.48s user 0.12s system
100% cpu 1.602 total

LuaJIT is 2.8x times faster splitting strings. I am running
Ubuntu-10.04 (32-bit) virtual machine under Parallels on Mac OSX host
(10.6.8).

--Leo--

Other related posts: