Post Reply 
Varying speed when running program
03-18-2019, 08:18 AM
Post: #1
Varying speed when running program
When playing with some cellular automata, I had now a smaller program showing speed variation when executed.
Code:
#pragma mode( separator(.,;) integer(h32) )
EXPORT Langton() BEGIN
 LOCAL DX:=[0,1,0,−1];
 LOCAL DY:=[1,0,−1,0];
 LOCAL ST:=TICKS;
 RECT();
 160▶X;120▶Y;1▶D;0▶N;
 REPEAT
  IF GETPIX_P(X,Y) THEN (D MOD 4)+1▶D;PIXON_P(X,Y,#000000);
  ELSE ((D+2) MOD 4)+1▶D;PIXON_P(X,Y,#FFFFFF);END;
  (X+DX(D)) MOD 320▶X;(Y+DY(D)) MOD 240▶Y;N+1▶N;
 UNTIL GETKEY=41;
 RETURN 1000*N/(TICKS-ST);
END;
Severall runs leads to this kind of speed (measured as generations by second)
Code:
10739
10720
9615.9
4573.2
3718.8
1141
733.19
726.11
727.4
Each run was done for a few seconds. When speed is slow, it stay slow even when using keyboard during the run. Turning calc off and on next day gives:
Code:
680.13
740.29
687.81
435.92
506.47
515.38
516.15
10791
Running the program was done in HOME, by typing Langton then ENTER, stopping it is done by pressing SHIFT, re-run it is done by simply pressing again ENTER and so on ...

This was done without usb connection on G2 hardware (I can not test it on older hardware revision).

There are also some problems with matrix in HOME mode (see Other bugs)

P.S. I still talk about varying speed because nobody seems to react to this kind of annoying problem...

Olivier
Find all posts by this user
Quote this message in a reply
03-18-2019, 02:16 PM
Post: #2
RE: Varying speed when running program
I had (maybe I still have, but I didn't test it for long time) problem with inconsistent speed too (on android app, I don't have real calculator).

Speed depended on number of stored programs in Prime. When I had clean calculator with only one program (468 lines of code) then its running speed was noticeably faster (cca from 1.5x to 3x, I don't remember exactly) than when I had stored another program (namely eqnlib with 640 lines of code).

Maybe it is not relevant to your case, but who know.

Prime, 15C CE
Find all posts by this user
Quote this message in a reply
03-18-2019, 04:49 PM
Post: #3
RE: Varying speed when running program
(03-18-2019 02:16 PM)chromos Wrote:  I had (maybe I still have, but I didn't test it for long time) problem with inconsistent speed too (on android app, I don't have real calculator).

Does Android allow programs to run in the background? That could account for a wide variation in benchmarks depending on how many background programs there are and what they're doing.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
03-18-2019, 06:38 PM
Post: #4
RE: Varying speed when running program
(03-18-2019 04:49 PM)toml_12953 Wrote:  
(03-18-2019 02:16 PM)chromos Wrote:  I had (maybe I still have, but I didn't test it for long time) problem with inconsistent speed too (on android app, I don't have real calculator).

Does Android allow programs to run in the background? That could account for a wide variation in benchmarks depending on how many background programs there are and what they're doing.

Yes, it does, to a degree. Newer versions of Android do more to catch and warn about excessive background activity.

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot
Casio, Rockwell 18R
Find all posts by this user
Quote this message in a reply
03-19-2019, 01:52 AM (This post was last modified: 03-19-2019 02:06 AM by chromos.)
Post: #5
RE: Varying speed when running program
(03-18-2019 04:49 PM)toml_12953 Wrote:  
(03-18-2019 02:16 PM)chromos Wrote:  I had (maybe I still have, but I didn't test it for long time) problem with inconsistent speed too (on android app, I don't have real calculator).

Does Android allow programs to run in the background? That could account for a wide variation in benchmarks depending on how many background programs there are and what they're doing.

My english isn't much good, but I'll try to explain my tests more in-depth.

1) I dragged my Geosolver from ConKit to Prime app (where I had only one other program - eqnlib). Running time of my program was "X".

2) Over time, calc reseted itself (it was early firmware), so I dragged Geosolver from ConKit into clean app again. Running time "Y" was noticeably shorter than "X".

3) I added eqnlib by dragging from ConKit and running time of Geosolver was "X" again.

4) I deleted eqnlib from app and running time was "Y" again.

"X" and "Y" are in minutes, so it was easily observable.

Maybe some background tasks were responsible for it, but how those background services did know how many programs I had in my Prime app? :-))

P.S. Points 1) to 4) may not correspond exactly to reality, but certainly it isn't far from the truth.

Prime, 15C CE
Find all posts by this user
Quote this message in a reply
03-20-2019, 12:55 AM
Post: #6
RE: Varying speed when running program
Interesting observations.

Most of my testing during development is done on the Virtual Prime on a PC, so had not noticed anything there. On a G2, I can definitely confirm what is described. Some of the more intensive tasks will happen almost instantaneously, while the next time around there is a very noticeable delay. The magnitude of the delay varies. Nothing else changes, exact same configuration and memory use, totally different outcomes.

I have my G1 at work, will test with it when I get a chance.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)