# Responsive GUI

Here is a free book in AP1 that you can download to help experiment with threads and timers.

Sincerely,

Eugene

2 Likes

Can you give us a thumbnail explanation of the math youâre having to perform? This will help us suggest the right approach to take. I looked up that method but the theoretical explanation is way, way over my head.

Thanks, Tim.

Jana, the question is: âDo you need this problem fixed in 30 minutes or 30 days?â

As a long-time production programmer, I used to argue with the computer scientists my firm hired as programmers. The firm needed software fixes that would run tonight - quick and nasty. The computer scientists wanted to write elegant and beautiful software that would run in 1 monthâs time or more.

Yes, quick and nasty is evil, but it kept the customers happy, giving us time and money to do the ârightâ thing.

Thank you for sharing @Eugene_Dakin your help is much appreciated

Hello Eric, Actually, SVD was an example. Im working in general with lengthy algorithms; I have some that may take more than 5 minutes to execute.
If you are interested SVD is divided into 4 main for loops, in each loop there are many nested for loops and mathematical operations (matrix multiplications, normalization, etc.).
We have an input matrix A, and we write it as the product of three matrices, UWV, To find these matrices, we calculate the eigenvalues and eigenvectorsâŠ

Thank you @Mike_Linacre1 for your suggestion, i will explore it

Just donât confuse âfixâ with âworkaroundsâ pushing problems to the future. And âfutureâ may be a question of hours, not years. The âit worked in my machineâ became a meme because of that. Sometimes all it takes is a slightly faster or slower machine to fire a bad code bug.

Everyone, everywhere, want things fixed ASAP. No one should desire exchanging a known problem by another new one coming from nowhere as firing events where they should not be fired. A bug that could not be noticed today may rise tomorrowâŠ âfrom nowhereâ. Take an extra hour and avoid bad code. 30 min and 30 days is just too much exaggeration.

2 Likes

OK - thatâs a little helpful. I have two suggestions:

First, in your SVD example: if your 4 main For loops are independent (i.e., they donât share data during operation or and donât need to be run in any particular sequence), you will get a massive performance increase by splitting them into independent console apps and running them via a Shell. Or, use a Worker setup - itâs the same thing. This will let you use 4 additional CPU cores.

If your loops are interdependent - they share data during operation, or one loop relies on the result of another loop - then setting it up as a Worker/console app will help your main appâs GUI responsiveness but wonât have much impact on performance.

Secondly, matrix math is a very common operation and there are libraries that accelerate it using the CPUâs vector operations. This is (likely) hundreds of times faster than loops. On MacOS, look at Appleâs Accelerate framework; on Windows, it looks like DirextXMath is a good starting point. The work needed to integrate these APIs into Xojo can be gnarly at times but I promise you the performance payoff will be worth it!

1 Like

Thank you @Eric_Williams your help is much appreciated