IDE compiled program performance

Piero: there’s a bad bug in the program - you start the timer before the MsgBox() call - so the time spent waiting for the user to hit “OK” is included in the timing, so that throws everything off.

To fix this move these lines:

 qq="Start: size of the matrix:  "+str( n)+" x "+str(n)

immediately before this line:


That way, the timer is not started until the user hits “OK”.

With those changes, I get the following timings (which are now reliable):

N= 200. IDE: 15.8 seconds. Built App: 8.9 seconds

(p.s. thank you for this, I love benchmarking tests)

I made a few more changes.


#pragma DisableBackgroundTasks

to the two methods, I get the following timings:

IDE: 14.1 seconds. Built App: 6.8 seconds (a 25% improvement)

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
        end if
        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:

#pragma DisableBoundsChecking

This drops it from 6.8 seconds to 6.5 seconds (only a 5% improvement).

On my i5 running Windows 8 the IDE 100x100 took 3.07 seconds, compiled 2.15.

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.

Reposted the corrected project at:

iMac13,2 / OS X 10.8.4
Intel Core i5-3470 CPU @ 3.20GHz

Build: 0.9330039
IDE: 1.640934

Build: 7.896024
IDE: 13.61168

Using new Project, 100x100 IDE: 1.33 compiled 0.840

Corrected project is much faster.

100x100 IDE:2.36 compiled 1.27
200x200 IDE:20.13 compiled 11.27

Tried also with xojoScript:
100x100 IDE: 0.70 compiled 0.70
200x200 IDE: 6.06 compiled 6.16

with an old iMac Core 2 Duo 3Ghz

Windows 7 pro (64bit)
Intel Pentium Dual CPU E2180 2.00GHz

100x100 IDE:2.90 Compiled 1.60
100x100 Console Mode Compiled: 1.57

200x200 IDE:24.51 Compiled 13.10
200x200 Console Mode Compiled: 13.38

No big different between IDE and Console in this case

I have now data for the VB6 run on Duo T8300 2.4 GHz (Win7/64):

100x100 VB6-IDE:3.1 Compiled: 0.81
200x200 VB6-IDE:27 Compiled: 6.9

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) (
The present results suggest that the porting would be worthtrying


for better results on number crunching you can do a couple of things:

  1. better code optimization (there is some space for this, I think)
  2. use a plugin for handling matrixes and calcs. It seems to me there is something specific to your needs, but I don’t remember the name at this time. I can search if needed.

Oh, and happy to see an italian here. From my region too! :smiley:


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.

Here are some plugins you might find interesting:

I used the ‘Extended Plugin’ from Bob Delaney to calculate Pi in millions of digits…

Dealney page is really impressive…

[quote=13482:@Sebastian Niesen]iMac13,2 / OS X 10.8.4
Intel Core i5-3470 CPU @ 3.20GHz

Build: 0.9330039
IDE: 1.640934

Build: 7.896024
IDE: 13.61168[/quote]

And here’s my iMac13,2 / OS X 10.8.4
Intel Core i7-3770 CPU @ 3.40GHz

Build: 7.187193
IDE: 1.498716

Build: 7.896024
IDE: 12.44599

About what I expected.

I’m also looking at converting a VB6 application to Xojo (for Win & OSX). Performance is critical as the program monitors several UDP data streams.

My 5 year old Mac Mini Duo does 200x200 in 29.3788 seconds via the IDE, or 15.3811 seconds on my Win7 i7.

Has there been any progress adding LLVM?

I speak under correction, but I think they need LLVM for iOS builds, and from this blog it looks like they are making progress with such developments…

thank you Piero Ugliengo for starting this thread. I am also looking to move 3 large projects to xojo(from vb6), but as I suspected I need to wait until LLVM is implemented as indicated by this test.

Very valuable information, thanks for everyone’s efforts