lua-users home
lua-l archive

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


Adam Strzelecki <ono <at> java.pl> writes:
 
> C-style vec(n) run
> secs: 	2.796316
> 
> Vec(n) run
> secs: 	2.916069
> secs: 	3.567791 (bounds check)
> 
> C-style mat(nrows, ncols) run
> secs: 	2.792748
> 
> Mat(nrows, ncols) run
> secs: 	2.78517
> secs: 	2.89588 (bounds check)
> 
> Pure C implementation mat(nrows, ncols) run [see below]
> secs:	1.859779 (gcc -O3)
> secs:	2.084383 (gcc -O2)
> secs:	6.461822 (gcc -O0)

Some considerations, I hope not too off-topic (my platform is VS2010 for c/c++
code):

1) I had to modify the timing part of the code, as sys/time.h is not there in
windows environments

2) In the version you posted, the execution time is 0 in release mode (VS2010 
noticed z is never used and throw away all the bench_matplain code :D)

3) Fixing this issue, I got a stack overflow error (I think it did not like the 
huge array on the stack)

4) Allocating the array on the heap gave me identical performance to the LuaJIT
benchmark with bounds checking disabled.

I suspect that you would get the same results printing z after the computations
and allocating the array on the heap.