02-29-2020, 05:00 PM
By making use of the automatic Ans variable, and playing a bit fast and loose with the parser, it's possible to squeeze a bit more speed out of the n-queens program for the fx-4000P, and presumably most (all?) of the models that use the same benchmark program.
Modified version:
By omitting the store into variable T, and instead letting A[X]-A[Y (omission of the final bracket is deliberate) automatically store in Ans, the execution time on my fx-4000P dropped from 00:05:57 to 00:05:41 (+/- 1 sec. margin of error on measurements). So, roughly a 4.5% reduction in execution time.
Note that you can't leave out the closing bracket for array references that are the target of a store or Dsz/Isz, so R->A[X] and Dsz A[X] can't benefit from this optimization.
Now somebody needs to go re-test the FX-6000G, FX-6300G, FX-6500G, FX-7000G, FX-7000GA, FX-7000GB, FX-7200G...
Modified version:
Code:
Mcl
8->R
Lbl 0 X=R=>Goto 4
Isz X
R->A[X]
Lbl 1 Isz S
X->Y
Lbl 2 Dsz Y Deg
Y=0=>Goto 0
A[X]-A[Y
Ans=0=>Goto 3
X-Y<>Abs Ans=>Goto 2
Lbl 3 Dsz A[X] Goto 1
Dsz X Goto 3
Lbl 4 S
By omitting the store into variable T, and instead letting A[X]-A[Y (omission of the final bracket is deliberate) automatically store in Ans, the execution time on my fx-4000P dropped from 00:05:57 to 00:05:41 (+/- 1 sec. margin of error on measurements). So, roughly a 4.5% reduction in execution time.
Note that you can't leave out the closing bracket for array references that are the target of a store or Dsz/Isz, so R->A[X] and Dsz A[X] can't benefit from this optimization.
Now somebody needs to go re-test the FX-6000G, FX-6300G, FX-6500G, FX-7000G, FX-7000GA, FX-7000GB, FX-7200G...