[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT2 performance for number crunching
- From: Leo Razoumov <slonik.az@...>
- Date: Thu, 17 Feb 2011 12:57:13 -0500
On Thu, Feb 17, 2011 at 11:26, T T <t34www@googlemail.com> wrote:
> I get 9.30sec on my machine. An equivalent Lua code takes 2.55sec.
> So MATLAB is clearly not as good as luajit, but not as terrible as
> some would like to make it.
>
Try this:
sh$ cat bmark_euler.m
% Benchmark: Euler constant
% Run as: sh$ time matlab -nodesktop -nosplash -nojvm -r bmark_euler
tic
sum= 0;
N= 1E7;
for n=1:1:N
sum = sum + 1/n;
end
euler= sum - log(N);
fprintf('N = %G\n', N);
fprintf('euler= %G\n', euler);
toc
quit
%EoF
sh$ matlab -nodesktop -nosplash -nojvm -r bmark_euler
>> N = 1E+07
euler= 0.577216
Elapsed time is 14.002463 seconds.
sh$ <0> time lua bmark_euler.lua
N = 1E+07
euler= 0.577216
lua bmark_euler.lua 0.33s user 0.00s system 98% cpu 0.337 total
The performance ratio is 40 times in favor of Lua-5.1.4 *interpreter*.
I guess LuaJIT-2 will be even better.
MATLAB sucks on loops!
Here is my system info:
*M A T L A B (R) Version 7.10.0.499 (R2010a) 64-bit
* Lua-5.1.4 interpreter
* Linux CentOS release 5.5 x64 Linux 2.6.18-194.26.1.el5
* Intel(R) Xeon(R) CPU E5530 @ 2.40GHz () 4x4 cores, 72GB RAM
--Leo--
- References:
- Re: LuaJIT2 performance for number crunching, Florian Weimer
- Re: LuaJIT2 performance for number crunching, Francesco Abbate
- Re: LuaJIT2 performance for number crunching, Leo Razoumov
- Re: LuaJIT2 performance for number crunching, Francesco Abbate
- Re: LuaJIT2 performance for number crunching, Leo Razoumov
- Re: LuaJIT2 performance for number crunching, Francesco Abbate
- Re: LuaJIT2 performance for number crunching, Leo Razoumov
- Re: LuaJIT2 performance for number crunching, Francesco Abbate
- Re: LuaJIT2 performance for number crunching, T T
- Re: LuaJIT2 performance for number crunching, Daurnimator
- Re: LuaJIT2 performance for number crunching, Mike Pall
- Re: LuaJIT2 performance for number crunching, Philippe Lhoste
- Re: LuaJIT2 performance for number crunching, Alexander Gladysh
- Re: LuaJIT2 performance for number crunching, Miles Bader
- Re: LuaJIT2 performance for number crunching, T T
- Re: LuaJIT2 performance for number crunching, steve donovan
- Re: LuaJIT2 performance for number crunching, T T
- Re: LuaJIT2 performance for number crunching, Leo Razoumov
- Re: LuaJIT2 performance for number crunching, T T