Optimization level=Aggressive hangs Xojo?

Here, on both macOS and Windows, switching the Optimization level to Aggressive = Application Not Responding. force quit is the only option:(
It works here in Run actions but not for Build which is the only thing I really need it for;)
Strange because I remember it worked just not sure it was in Xojo 2019r3.1 as I’m trying right now.
Anyone seeing this too or have an idea if it’s a known bug?

Something to note is that the IDE always hangs when it’s compiling. The more work it has to do, the more noticeable the hang is. Aggressive Optimization is a lot of work, have you given the compiler enough time?

Run doesn’t use the optimization setting which is why this may be working.

Is this happening with your project or a new blank test project? Have you tried it with a new blank test project?

Ahhh that explains hahaha:)

I tried now with another project and it works, so it seems it only crashes with my latest project :astonished:

If you are able, the best thing would be to add a private feedback ticket and let xojo look at it. If you can’t make a copy of the project and remove large parts of it until it works, then restore parts until you can figure out where the problem lies.

1 Like

Wait a sec… is it hanging or is it crashing? They’re two very different things, especially for compiling.

If it truly is just appearing to hang, I’d be curious to know how long you let the IDE run before you gave up waiting. As others have said, Aggressive can take a very long time to compile.

You are absolutely right, wrong choice of words saying ‘crashes’
It hangs on both Window and macOS and I leave it to hang for about half an hour until I decide to give up and force quit.

I’m now trying to figure out if I can strip some code to make it work in hope I will find the blockage…

Okay, so I tried some things and eventually I removed a module I could leave without and after 15 minutes hang it finally prevailed!
The odd thing is, the app is about 8,600 KB in normal build mode and 57,000 after aggressive build, it uses about 15 MB RAM after default optimization level and about 31 MB after aggressive optimization level.
Is that sounds normal?

[Edit] Correction, it actually uses a bit less RAM after optimization than in default optimization level, I didn’t compare apples to apples earlier :flushed:
But the build size is still 7 times bigger, sounds like a huge difference to me, isn’t not?

If you drop that module into a new test project and build that does it take a long time?

Do you see the long build times in other versions at the same optimisation level?

That seems a little strange. I’m not surprised the binary gets bigger as compilers will often inline functions (thereby duplicating code), unroll loops (duplicating code) and create abstractions (duplicating code) but a 7x increase in binary size seems quite bit. Perhaps one of the engineers can shed some light on things.

Well, it increases the build time on a simple test project but nothing I would rant about, it could have been a kinda ‘last straw’ in an already complex project…

Regardless, the fact that it hangs, showing spinning beach ball for a very very long time and reported by the OS as Not Responding after about one minute till it ends 15 to 20 minutes later, is really not an assuring experience. And at the end it doesn’t feel like the wait was worth it when I get 7x in size binary and almost the same RAM usage (+/- 1 MB), I can’t even say I feel the app operation is significantly snappier.

Just saying:)

The benefit you get from Aggressive is largely from math heavy operations, so if you’re doing things that are just using UI or database connections or File I/O for example, you won’t necessarily see any benefit.

A good example is the IDE itself. We compile as Aggressive because it we get improvements in the speed of the code and layout editors… and it takes ~40 minutes per platform to compile. It also increases the size of the IDE by about 300MB.

What I’m getting at is that if your app doesn’t benefit from Aggressive, don’t use it.

2 Likes

Thanks for the detailed answer Greg, I do have all of the above (Math, File I/O, UI graphics, etc.) so I’ll have to give it some time and see if Aggressive is really a benefit for this project or should I go with the Default.
BTW, does ‘Moderate’ performers more optimization than the Default?

It does.

1 Like

Thanks:)

As mentioned earlier, this can happen with unrolling loops.
if you have for
x as integer = 0 to 10
something = format(x,“0”)
next

it is marginally faster (and therefore aggressively chosen) to turn that into 11 lines of code

I have apps that loop through 1 million items using a for…next
No chance…

1 Like

Great example Jeff :laughing:
I do have a lot of loops and many one line codes that uses several functions within that I assume dissolve in aggressive mode into many lines of code.
Thanks for your input;)