lua-users home
lua-l archive

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


Why is the Java 1.2.1 greatly improved over the 1.1.6 vm?
>From 44.1 to 1.2?  

Jim


> -----Original Message-----
> From: Ken Rawlings [mailto:krawling@shooter.bluemarble.net]
> Sent: Tuesday, July 20, 1999 3:00 PM
> To: Multiple recipients of list
> Subject: Re: Lua Benchmark
> 
> 
> 
>    Since there seems to be quite a bit of interest in Lua benchmarks,
>    here's my results from a multi-language numeric benchmark I ran a
>    while back to get a general feel for the speed of several 
> languages.
> 
>    In each case nothing special was done for optimization, either in 
>    the language or in the compiler settings. Take the benchmark with
>    a large grain of salt -- it's by no means comprehensive.
> 
>    (PII300, NT4.0):
>  
>    Language             Seconds
>    -------------------  -------
>    C [MSVC 5.0]         1.5
>    Java 1.2.1 (Classic) 1.2
>    Java 1.1.6           44.1
>    Lua 3.1              65.8
>    Perl 5.005           202.8
>    Python 1.5.2         91.2
>    TCL 8.1              205.6
>    TCL 8.0.5            392.9
> 
> _Ken
> 
> 
> Here's the Lua code:
> ----
> function pnpoly(npol, xp, yp, x, y)
>         local i, j, c
>         c = 0
>         i = 1
>         j = npol
>         while i <= npol do
>                 if (yp[i] <= y and y < yp[j]) or (yp[j] <= y 
> and y <  yp[i])
>                         and (x < (xp[j] - xp[i]) * (y - 
> yp[i]) / (yp[j] - yp[i])
>  + xp[i]) then
>                         c = not c
>                 end
>                 j = i
>                 i = i + 1
>         end
>         return c
> end
>  
> npol = 20
> count = 0
> xp = { 0.0,1.0,1.0,0.0,0.0,1.0,-.5,-1.0,-1.0,-2.0,
>       -2.5,-2.0,-1.5,-.5,1.0,1.0,0.0,-.5,-1.0,-.5 }
> yp = { 0.0,0.0,1.0,1.0,2.0,3.0,2.0,3.0,0.0,-.5,
>       -1.0,-1.5,-2.0,-2.0,-1.5,-1.0,-.5,-1.0,-1.0,-.5}
> i = 0
> while i < 50000 do
>     if pnpoly(npol,xp,yp,0.5,0.5) then count = count + 1 end
>     if pnpoly(npol,xp,yp,0.5,1.5) then count = count + 1 end
>     if pnpoly(npol,xp,yp,-.5,1.5) then count = count + 1 end
>     if pnpoly(npol,xp,yp,0.75,2.25) then count = count + 1 end
>     if pnpoly(npol,xp,yp,0,2.01) then count = count + 1 end
>     if pnpoly(npol,xp,yp,-.5,2.5) then count = count + 1 end
>     if pnpoly(npol,xp,yp,-1.0,-.5) then count = count + 1 end
>     if pnpoly(npol,xp,yp,-1.5,.5) then count = count + 1 end
>     if pnpoly(npol,xp,yp,-2.25,-1.0) then count = count + 1 end
>     if pnpoly(npol,xp,yp,0.5,-.25) then count = count + 1 end
>     if pnpoly(npol,xp,yp,0.5,-1.25) then count = count + 1 end
>     if pnpoly(npol,xp,yp,-.5,-2.5) then count = count + 1 end
>         i = i + 1
> end
> print("count " .. count)
> ----
>