GLBasic forum

Main forum => GLBasic - en => Topic started by: Qedo on 2011-Aug-29

Title: float matrix multiplication benchmark
Post by: Qedo on 2011-Aug-29
I ask two things to those more experienced than me.
1) between GLB and C, in the float matrix multiplication benchmark, why there is a relationship in the rate of 5/1?   1400ms GLBasic and 300ms INLINE C. I think too high
2) Why the local arrays slow the program by 60%? LOCAL=2300ms against GLOBAL=1400ms.
To see this uncomment:
// LOCAL  a[]
// LOCAL  b[]
// LOCAL  c[]
Ciao

[attachment deleted by admin]
Title: Re: float matrix multiplication benchmark
Post by: Kitty Hello on 2011-Aug-29
having a,b,c as locals would require a reallocation for each function call. That's slow.
With INLINE C++ you get the direct access to the array elements and the compiler is smart enough to optimize here, so it drops some multiplications or does them in the compile stage.

The GLBasic arrays are function calls on run time and also have a bounds check, even in release mode. That might be slower, but you surely don't want to overwrite memory and have totally strange results instead of a proper error message.