Xojo Apps Slow?

When doing a

For I = 0 to 100000000 xojo needs around four seconds for it, J.v. Not even a second. Even

#Pragma BackgroundTasks False
#Pragma NilObjectChecking False

Var start As Double
start = datetime.now.SecondsFrom1970

For i As Integer = 1 To 100000000  

Var dauer As Double
dauer = datetime.now.SecondsFrom1970 - start

It costs three seconds , with p…l it costs less than a second and also XX++ does it under a second.

This is the same case under windows, Linux and MAC osX.

So far so good why I can not get even half of the speed as other languages? Did also a try with Linux g…s what done it in 1.04 seconds, a language which is hit compiled.

Is the any other chance to optimize it?

Are you running this in a debug session or as a built app? We do inject some additional debugging information for debug builds FWIW.


The compiled version needs 0.151711 seconds

On Linux it’s much slower trust me. And no, builder. The Mac I am using is old so it is not counting but

Try a build, compile agrressive and it will strip the empty loop as far as my counting goes…

And you can use even more pragmas to speedup

Java does essentially the same, i think it strips the entire loop…

But it is interesting that it is in the other languages also not optimized! So it is to slow without pragmas

Other languages will eliminate the loop completely.

1 Like

Yes they will but why not xojo?

Are you timing a loop or asking about how much optimisation the compiler does?

First: I am asking why the loop was so slow. Second: it’s important to have the security that the compiler is delivering fast code for a simple loop

Xojo with default compilation:

0x10012d711 <+273>: movq   $0x0, -0x28(%rbp)
0x10012d719 <+281>: movb   $0x0, -0x29(%rbp)
0x10012d71d <+285>: movq   $0x0, -0x38(%rbp)
0x10012d725 <+293>: movq   $0x1, -0x28(%rbp)
0x10012d72d <+301>: movl   $0x5f5e100, %eax          ; imm = 0x5F5E100 
0x10012d732 <+306>: movl   %eax, %ecx
0x10012d734 <+308>: cmpq   -0x28(%rbp), %rcx
0x10012d738 <+312>: setl   %dl
0x10012d73b <+315>: andb   $0x1, %dl
0x10012d73e <+318>: movb   %dl, -0x29(%rbp)
0x10012d741 <+321>: cmpb   $0x0, %dl
0x10012d744 <+324>: je     0x10012d768               ; <+360>
0x10012d766 <+358>: jmp    0x10012d77c               ; <+380>
0x10012d768 <+360>: jmp    0x10012d76a               ; <+362>
0x10012d76a <+362>: movq   -0x28(%rbp), %rax
0x10012d76e <+366>: addq   $0x1, %rax
0x10012d772 <+370>: movq   %rax, -0x38(%rbp)
0x10012d776 <+374>: movq   %rax, -0x28(%rbp)
0x10012d77a <+378>: jmp    0x10012d72d               ; <+301>

Xojo will do the loop and use addq to add 1 to the integer and actually run the loop 0x5f5e100 Times.

1 Like

With aggressive compilation, the loop is gone in assembly. Time is now 0.000139 for me here, which mostly may be time needed to query time.


Geht also nur mit aggressiver Optimierung, gut zu wissen, vielen Dank does only work with aggressive optimizatio , good to know.

I didn’t try the medium level, but you can try it.