I’m seeing 15.8 in the IDE which drops to 6.8 in a built app with background tasks off, a 230% difference. I suspect this is close to your VB6 results, suggesting that the IDE and xojo framework overhead are to blame, but can be eliminated quite easily.
For fun, I tried to optimize your code - my first target was to get rid of function calls, so I inlined the Abs() calls by replacing them with a temp variable and an if statement:
g = 100. * Abs(a(ip, iq))
tmp2 = a(ip,iq)
if tmp2 < 0 then
g = 100 * tmp2
This doesn’t seem to help at all, and may hurt - it goes from 6.8 to 6.9 seconds in my testing. Hmm. This surprises me as I thought function calls were expensive in Xojo - maybe Abs() is not?
Next, I removed the bounds checking in the array code, adding this to both methods:
This drops it from 6.8 seconds to 6.5 seconds (only a 5% improvement).
Michael: you are absolutely right, the timing was bugged. I have moved the lines and
it should be ok now. Probably this did not dramatically affect the timing, as people tend to
click the OK button without waiting more than a fraction of a second.
As a very rough conclusion from previous data it turned out that the old VB6 is still a strong competitor as far as
number crunching is concerned.
Considering all timing as an absolute scale without bothering with different arch and CPUs , only
the xojoscript from Rinaldi is close to the VB6 results.
As Geoff Perlman pointed out, the xojoscript should be as efficien as the LLVM compiler expected in the near future.
The above test was made to assess the portability to xojo (in term of performance) of a molecular graphic code I have developed
since long ago in pure VB6 (no OpenGl and alike) (http://www.moldraw.unito.it)
The present results suggest that the porting would be worthtrying
for sure there is a lot of room for improvement as the Jacobi algorithm is the simplest and the code was not optimized at all.
My purpose was just to grasp the general behaviour of the two world (VB6 and Xojo) and what to expect when converting
a piece of code representative of numerical (and memory) intensive task from VB6.
Optimized plugins specific to linear algebra would be very useful for my purposes.