HP Forums

Full Version: HP questions about program execution speed.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
1. If running a Home program using Home instructions to execute an algorithm or a CAS program using CAS instructions, which runs faster, the CAS program or the Home program. e.g. Using increment in CAS vs x:=x+1 in Home.

2. If running a CAS program or a Home program, but this time using the same instructions, which is faster.

3. If using a mix of CAS and Home instructions, but the same instructions in both CAS and Home versions, does the Home program run slower if it has to use CAS.function() in the Home version instead of just function() in the CAS version.

Thanks
-Donald
Home programs are faster than CAS equivalents, except if you can replace inner loops by one CAS command. I have implemented some optimizations for for loops in giac that should make the difference less sensible, they will probably be available in a future firmware...
1/2. HOME will be faster always*(have yet to find something equivalent where it is not) for equivalent operations. Less checking of object types, parsing is faster, execution has less overhead, less memory allocations, etc.

3. The largest slowdown from mixing CAS/HOME stuff is that when passing variables to the CAS, or back to HOME, an object converter will convert between home objects/cas objects. This is by necessity much slower due to large amount of work/checking that happens to make things work "pretty much" the way you expect.


So for max performance, avoid doing critical time loops that have any sort of mixing/matching and stay in one side of the other for the duration of a loop to the extent possible.
Reference URL's