# IDE compiled program performance

**URL:** <https://forum.xojo.com/t/ide-compiled-program-performance/8776>\
**Category:** Getting Started\
**Created:** [June 11, 2013, 4:47pm UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776 "2013-06-11T16:47:54Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [June 11, 2013, 11:04pm UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/21 "2013-06-11T23:04:57Z")

</div>

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:

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

immediately before this line:

```auto
tempo1=microseconds
```

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

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [June 11, 2013, 11:11pm UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/22 "2013-06-11T23:11:37Z")

</div>

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

I made a few more changes.

Adding

```auto
#pragma DisableBackgroundTasks
```

to the two methods, I get the following timings:

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

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [June 11, 2013, 11:46pm UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/23 "2013-06-11T23:46:00Z")

</div>

> [@13305:@Piero Ugliengo](#):
>
> Thanks a lot! Is it possible to quantify how much faster? I’m asking as I was rather disappointed to find that a simple matrix diagonalization ported from VB6 took about twice as much on the xojo IDE to complete than on the old VB6 IDE. Useless to say that the code was exactly the same for VB6 and xojo as far as data types, loop counts and alike.

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:

```auto
g = 100. * Abs(a(ip, iq))
```

becomes

```auto
        tmp2 = a(ip,iq)
        if tmp2 < 0 then
          tmp2=-tmp2
        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:

```auto
#pragma DisableBoundsChecking
```

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

---

<div class="post-metadata">

**Author:** ![Gurdip\_Gill](https://forum.xojo.com/letter_avatar_proxy/v4/letter/g/a698b9/32.png) [@Gurdip\_Gill](https://forum.xojo.com/u/Gurdip_Gill)\
**Post date:** [June 12, 2013, 1:18am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/24 "2013-06-12T01:18:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Piero\_Ugliengo](https://forum.xojo.com/letter_avatar_proxy/v4/letter/p/ec9cab/32.png) [@Piero\_Ugliengo](https://forum.xojo.com/u/Piero_Ugliengo)\
**Post date:** [June 12, 2013, 5:28am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/25 "2013-06-12T05:28:51Z")

</div>

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:

[https://dl.dropboxusercontent.com/u/2287430/eigen.xojo\_binary\_project](https://dl.dropboxusercontent.com/u/2287430/eigen.xojo_binary_project)

---

<div class="post-metadata">

**Author:** ![Sebastian\_Niesen](https://forum.xojo.com/user_avatar/forum.xojo.com/sebastian_niesen/32/201_2.png) [@Sebastian\_Niesen](https://forum.xojo.com/u/Sebastian_Niesen)\
**Post date:** [June 12, 2013, 5:47am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/26 "2013-06-12T05:47:31Z")

</div>

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

100x100  
Build: 0.9330039  
IDE: 1.640934

200x200  
Build: 7.896024  
IDE: 13.61168

---

<div class="post-metadata">

**Author:** ![Gurdip\_Gill](https://forum.xojo.com/letter_avatar_proxy/v4/letter/g/a698b9/32.png) [@Gurdip\_Gill](https://forum.xojo.com/u/Gurdip_Gill)\
**Post date:** [June 12, 2013, 6:26am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/27 "2013-06-12T06:26:07Z")

</div>

Using new Project, 100x100 IDE: 1.33 compiled 0.840

Corrected project is much faster.

---

<div class="post-metadata">

**Author:** ![Antonio\_Rinaldi](https://forum.xojo.com/user_avatar/forum.xojo.com/antonio_rinaldi/32/331_2.png) [@Antonio\_Rinaldi](https://forum.xojo.com/u/Antonio_Rinaldi)\
**Post date:** [June 12, 2013, 6:46am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/28 "2013-06-12T06:46:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![John\_Hansen](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/b4bc9f/32.png) [@John\_Hansen](https://forum.xojo.com/u/John_Hansen)\
**Post date:** [June 12, 2013, 7:31am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/29 "2013-06-12T07:31:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Piero\_Ugliengo](https://forum.xojo.com/letter_avatar_proxy/v4/letter/p/ec9cab/32.png) [@Piero\_Ugliengo](https://forum.xojo.com/u/Piero_Ugliengo)\
**Post date:** [June 12, 2013, 8:23am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/30 "2013-06-12T08:23:08Z")

</div>

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) ([http://www.moldraw.unito.it](http://www.moldraw.unito.it))  
The present results suggest that the porting would be worthtrying

---

<div class="post-metadata">

**Author:** ![Massimo\_Valle](https://forum.xojo.com/user_avatar/forum.xojo.com/massimo_valle/32/23049_2.png) [@Massimo\_Valle](https://forum.xojo.com/u/Massimo_Valle)\
**Post date:** [June 12, 2013, 8:39am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/31 "2013-06-12T08:39:46Z")

</div>

Piero,

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.

---

<div class="post-metadata">

**Author:** ![Massimo\_Valle](https://forum.xojo.com/user_avatar/forum.xojo.com/massimo_valle/32/23049_2.png) [@Massimo\_Valle](https://forum.xojo.com/u/Massimo_Valle)\
**Post date:** [June 12, 2013, 8:47am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/32 "2013-06-12T08:47:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Piero\_Ugliengo](https://forum.xojo.com/letter_avatar_proxy/v4/letter/p/ec9cab/32.png) [@Piero\_Ugliengo](https://forum.xojo.com/u/Piero_Ugliengo)\
**Post date:** [June 12, 2013, 8:49am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/33 "2013-06-12T08:49:01Z")

</div>

Massimo,

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.

---

<div class="post-metadata">

**Author:** ![Massimo\_Valle](https://forum.xojo.com/user_avatar/forum.xojo.com/massimo_valle/32/23049_2.png) [@Massimo\_Valle](https://forum.xojo.com/u/Massimo_Valle)\
**Post date:** [June 12, 2013, 9:06am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/34 "2013-06-12T09:06:23Z")

</div>

Here are some plugins you might find interesting:

[http://delaneyrm.com](http://delaneyrm.com)

---

<div class="post-metadata">

**Author:** ![Alexander\_van\_der\_Linden](https://forum.xojo.com/user_avatar/forum.xojo.com/alexander_van_der_linden/32/323_2.png) [@Alexander\_van\_der\_Linden](https://forum.xojo.com/u/Alexander_van_der_Linden)\
**Post date:** [June 12, 2013, 9:27am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/35 "2013-06-12T09:27:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Piero\_Ugliengo](https://forum.xojo.com/letter_avatar_proxy/v4/letter/p/ec9cab/32.png) [@Piero\_Ugliengo](https://forum.xojo.com/u/Piero_Ugliengo)\
**Post date:** [June 12, 2013, 9:39am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/36 "2013-06-12T09:39:04Z")

</div>

Dealney page is really impressive…

---

<div class="post-metadata">

**Author:** ![Sebastian\_Niesen](https://forum.xojo.com/user_avatar/forum.xojo.com/sebastian_niesen/32/201_2.png) [@Sebastian\_Niesen](https://forum.xojo.com/u/Sebastian_Niesen)\
**Post date:** [June 12, 2013, 10:49am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/37 "2013-06-12T10:49:42Z")

</div>

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

100x100  
Build: 0.9330039  
IDE: 1.640934

200x200  
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

100x100  
Build: 7.187193  
IDE: 1.498716

200x200  
Build: 7.896024  
IDE: 12.44599

About what I expected.

---

<div class="post-metadata">

**Author:** ![John\_Jones1](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@John\_Jones1](https://forum.xojo.com/u/John_Jones1)\
**Post date:** [March 26, 2014, 10:13am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/38 "2014-03-26T10:13:26Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [March 26, 2014, 10:42am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/39 "2014-03-26T10:42:01Z")

</div>

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…

[http://www.xojo.com/blog/en/2014/01/ios-progress-report.php](http://www.xojo.com/blog/en/2014/01/ios-progress-report.php)

---

<div class="post-metadata">

**Author:** ![Winston\_Potgieter](https://forum.xojo.com/letter_avatar_proxy/v4/letter/w/848f3c/32.png) [@Winston\_Potgieter](https://forum.xojo.com/u/Winston_Potgieter)\
**Post date:** [April 12, 2014, 11:57am UTC](https://forum.xojo.com/t/ide-compiled-program-performance/8776/40 "2014-04-12T11:57:23Z")

</div>

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

[Previous page](https://forum.xojo.com/t/ide-compiled-program-performance/8776.md?page=1)

[Next page](https://forum.xojo.com/t/ide-compiled-program-performance/8776.md?page=3)
