Hi @Jana_El_Mourad,
Here is a free book in AP1 that you can download to help experiment with threads and timers.
Sincerely,
Eugene
Hi @Jana_El_Mourad,
Here is a free book in AP1 that you can download to help experiment with threads and timers.
Sincerely,
Eugene
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.
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âŠ
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.
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!