User Tools

Site Tools


benchmarks:addloop

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
benchmarks:addloop [2023/11/06 07:21]
jdb2 Minor typo/spelling fixup...
benchmarks:addloop [2023/11/06 07:27] (current)
jdb2 Corrected minor ommission in inner add loop code and source formatting
Line 1: Line 1:
 +====== Calculator Benchmark: Loops of addition ======
 +[[http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=1002|Calculator Benchmark: Loops of addition original entry on MoHPc]]
  
 +> Presently in order from fastest to slowest.
 +> This benchmark goes after ONLY goes after one thing: loops of addition.
 +  LBL 01 + GTO 01
 +where the stack contains 0 1 1 1 on 4 level machines. In other words, start with 0 and do repeated additions of 1 for 60 seconds. What is the result? Alternative methods that count 1 at a time are allowed and included, such as going through an ISG / DSE loop. Long repeated programs of + + + + are not.
 +
 +===== Physical calculators =====
 +
 +**Notation**
 +  * Calculator used and firmware/software 
 +  * The count after 60 seconds of execution 
 +  * The program code used.
 +
 +  - HP 50g 2.15, ARM ASM, 75MHz
 +    * Source [[http://community.casiocalc.org/topic/7183-help-needed-calculator-benchmark/#entry58775|3298 on Casio forum]]
 +    * Count: 593'615'984
 +      * Note: After toying around with the addloop benchmark, I found out that my optimization does really help a lot. After throwing it out (delete the lines that say ''TST R2,$F'' and ''BNE loop'') I just got 158998232. And when I increased the number of additions between the ON key checks from 16 to 256 (by replacing ''$F'' with ''$FF''), I even got **728'608'512**. The keyboard was still responsive enough, it "only" checked the ON key about 47000 times per second. [[http://community.casiocalc.org/topic/7183-help-needed-calculator-benchmark/#entry58785|3298]]
 +    * Note: I made a small optimisation: the ON key is only checked when the lowest 4 bits of the counter are 0. This avoids some memory accesses (ARM I/O is always memory-mapped) without losing too much precision - after all, I stopped it while looking at a normal clock. Also, I used two registers for the counter because I feared a single register would overflow. This was not the case, but as the result showed, 8 minutes would have made it overflow.
 +    * Code: ((<code>
 +CODE
 +GOSBVL SAVPTR
 +SKUB {
 +*start
 +!ARM
 +STMDB sp! {R4 R5 LP}
 +MOV R2,0
 +MOV R3,0
 +MOV R4,$7A00000 ;the lowest bit of $7A00054 is 1 if ON is pressed
 +ADD R4,R4,$54 ;the address needs to be loaded in two steps because ARM can only load 8 bits at a time
 +*loop
 +ADD R2,R2,1
 +ADC R3,R3,0
 +TST R2,$F
 +BNE loop
 +LDRB R5,[R4]
 +TST R5,1
 +BEQ loop
 +STR R2,[R1,#2316] ;Saturn A register, lower half
 +STR R3,[R1,#2320] ;Saturn A register, upper half
 +LDMIA sp! {R4 R5 PC}
 +!ASM
 +*end
 +}
 +C=RSTK
 +D0=C
 +D1=80100
 +LC(5)end-start
 +MOVEDN
 +LC 80100
 +INTOFF
 +ARMSAT
 +INTON
 +GOSBVL GETPTR
 +P=15
 +GOVLNG PUSHhxsLoop
 +ENDCODE
 +</code>)) 
 +  - HP 50g 2.15, HPGCC, 75MHz
 +    * Count: 161,722,281 
 +    * <code c>
 +#include <hpgcc49.h> 
 +int main(void) 
 +{     
 +  unsigned int c=0;     
 +  unsigned int volatile * GPFDAT = (int*) 0x7A00054;
 +
 +  sys_slowOff();     //press ON to stop     
 +  while(!(*GPFDAT&1))         
 +      c++;     
 +  sat_push_zint_llong(c);
 +  return 0; 
 +
 +</code>
 +  - Ti-89 Titanium, GCC4TI, HW4 running AMS 3.10 patched with my tiosmod+amspatch
 +    * Source: [[http://tiplanet.org/forum/viewtopic.php?p=147882#p147882|Lionel Debroux on Tiplanet.org]]
 +    * Count: 
 +      * around 25'000'000 for addloop 1 (using the CPU's registers)
 +      * around 9'800'000 for addloop2 (using also the ram)
 +    * Notes:
 +      * building them requires GCC4TI, they won't compile with the older, unmaintained and much harder to install TIGCC.
 +      * the main loop is a tiny code snippet buried into the rest of accuracy-increasing measures and dealing with the consequences of pressing the ON key;
 +      * the main loop in addloop1 is a 1:1 copy of that of the HP-50g benchmark;
 +      * the main loop in addloop2 is closer to interpreted languages, since at least, the variable is read from + written to memory, and it shows ~2.5x slowdown.
 +    * Code: see the note ((<code c>
 +Build script: ( all flags but -O3 reduce size but have no effect on code generation for the main loop)
 +tigcc -v -O3 -Wall -W -mpcrel --optimize-code --cut-ranges --reorder-sections --remove-unused --merge-constants -fmerge-all-constants -Wa,--all-relocs -Wa,-l -fverbose-asm -save-temps -o addloop1 addloop_register_polling.c
 +tigcc -v -O3 -Wall -W -mpcrel --optimize-code --cut-ranges --reorder-sections --remove-unused --merge-constants -fmerge-all-constants -Wa,--all-relocs -Wa,-l -fverbose-asm -save-temps -o addloop2 addloop_memory_polling.c
 +    
 +File addloop_register_polling.c:
 +// addloop_register_polling.c: optimize counting to the maximum, through keeping the value in a register and writing the main loop in ASM, so as to avoid compiler pessimizations.
 +
 +#define MIN_AMS 101
 +#define USE_TI89
 +#define USE_TI92P
 +#define USE_V200
 +#define USE_TI89T
 +#define NO_CALC_DETECT
 +#define OPTIMIZE_ROM_CALLS
 +#define RETURN_VALUE
 +
 +#include <stdint.h>
 +#include <system.h>
 +#include <args.h>
 +#include <estack.h>
 +#include <peekpoke.h>
 +#include <intr.h>
 +
 +#define TIMER_START_VAL (100000UL)
 +
 +void _main(void) {
 +    uint32_t i = 0; // We don't want to
 +    short orig_rate = PRG_getRate();
 +    unsigned short orig_start = PRG_getStart();
 +    unsigned char * ON_key_status = (unsigned char *)0x60001A;
 +    unsigned long val = 0;
 +
 +    // Make the system timer an order of magnitude more precise;
 +    // NOTE: this code assumes a HW2+ TI-68k, i.e. anything since 1999.
 +    PRG_setRate(1); // Increment counter at a rate of 2^19/2^9 Hz
 +    PRG_setStart(0xCE); // Trigger the interrupt every 257 - 0xCE = 51 increments ~ 20.07 Hz.
 +
 +    // The PRG_getStart() above effectively waited for the interrupt to trigger, so we don't need another wait.
 +    /*OSRegisterTimer(USER_TIMER, 1);
 +    while (!OSTimerExpired(USER_TIMER));
 +    OSFreeTimer(USER_TIMER);*/
 +    OSRegisterTimer(USER_TIMER, TIMER_START_VAL);
 +
 +    // Main loop :)
 +    // The assembly snippet is the equivalent of
 +    /*
 +    do {
 +        i++;
 +    } while (*(volatile unsigned char *)ON_key_status & 2);
 +    */
 +    // but it lets no compiler pessimization, such as constant-propagating the ON_key_status variable away (sigh), occur.
 +    asm volatile("lloop:\n"
 +    "    addq.l #1, %0\n"
 +    "    btst.b #1, (%1)\n"
 +    "    bne.s lloop\n"
 +        : "=d"(i) : "a"(ON_key_status));
 +
 +    // Retrieve timer value.
 +    val = TIMER_START_VAL - OSTimerCurVal(USER_TIMER);
 +    OSFreeTimer(USER_TIMER);
 +
 +    // Give some time for the ON key to come back up.
 +    OSRegisterTimer(USER_TIMER, 4);
 +    while (!OSTimerExpired(USER_TIMER));
 +    OSFreeTimer(USER_TIMER);
 +    OSClearBreak();
 +
 +    // Push arguments onto the RPN stack: clean arguments up, then create a list.
 +    while (GetArgType (top_estack) != END_TAG) {
 +        top_estack = next_expression_index (top_estack);
 +    }
 +    top_estack--;
 +    push_END_TAG();
 +    push_longint(i);
 +    push_longint(val);
 +    push_LIST_TAG();
 +
 +    // Restore old system state.
 +    PRG_setRate(orig_rate);
 +    PRG_setStart(orig_start);
 +}
 +
 +File addloop_memory_polling.c:
 +// addloop_memory_polling.c: don't optimize counting that much, through "volatile" which triggers three instructions instead of just one for dealing with memory and an address which gets constant-propagated instead of being kept in a register.
 +
 +#define MIN_AMS 101
 +#define USE_TI89
 +#define USE_TI92P
 +#define USE_V200
 +#define USE_TI89T
 +#define NO_CALC_DETECT
 +#define OPTIMIZE_ROM_CALLS
 +#define RETURN_VALUE
 +
 +#include <stdint.h>
 +#include <system.h>
 +#include <args.h>
 +#include <estack.h>
 +#include <peekpoke.h>
 +#include <intr.h>
 +
 +#define TIMER_START_VAL (100000UL)
 +
 +void _main(void) {
 +    volatile uint32_t i = 0;
 +    short orig_rate = PRG_getRate();
 +    unsigned short orig_start = PRG_getStart();
 +    volatile unsigned char * ON_key_status = (volatile unsigned char *)0x60001A;
 +    unsigned long val = 0;
 +
 +    // Make the system timer an order of magnitude more precise;
 +    // NOTE: this code assumes a HW2+ TI-68k, i.e. anything since 1999.
 +    PRG_setRate(1); // Increment counter at a rate of 2^19/2^9 Hz
 +    PRG_setStart(0xCE); // Trigger the interrupt every 257 - 0xCE = 51 increments ~ 20.07 Hz.
 +
 +    // The PRG_getStart() above effectively waited for the interrupt to trigger, so we don't need another wait.
 +    /*OSRegisterTimer(USER_TIMER, 1);
 +    while (!OSTimerExpired(USER_TIMER));
 +    OSFreeTimer(USER_TIMER);*/
 +    OSRegisterTimer(USER_TIMER, TIMER_START_VAL);
 +
 +    // Main loop :)
 +    // Let compiler pessimizations inherent to "volatile", such as:
 +    // * reading and writing i in memory instead of incrementing it directly;
 +    // * constant-propagating the ON_key_status variable away.
 +    // occur.
 +    do {
 +        i++;
 +    } while (*ON_key_status & 2);
 +
 +    // Retrieve timer value.
 +    val = TIMER_START_VAL - OSTimerCurVal(USER_TIMER);
 +    OSFreeTimer(USER_TIMER);
 +
 +    // Give some time for the ON key to come back up.
 +    OSRegisterTimer(USER_TIMER, 4);
 +    while (!OSTimerExpired(USER_TIMER));
 +    OSFreeTimer(USER_TIMER);
 +    OSClearBreak();
 +
 +    // Push arguments onto the RPN stack: clean arguments up, then create a list.
 +    while (GetArgType (top_estack) != END_TAG) {
 +        top_estack = next_expression_index (top_estack);
 +    }
 +    top_estack--;
 +    push_END_TAG();
 +    push_longint(i);
 +    push_longint(val);
 +    push_LIST_TAG();
 +
 +    // Restore old system state.
 +    PRG_setRate(orig_rate);
 +    PRG_setStart(orig_start);
 +}
 +</code> ))
 +  - HP-12C+, Scott’s custom firmware
 +    * Count: 10,794,647    
 +    * <code c> 
 +Do { ++x; } while ((((*(unsigned long int*)PIOC_PDSR) & c_mask)==c_mask)); 
 +</code>
 +  - Casio fx-CG 10 PRIZM, OS version 01.04.3200, C PrizmSDK (([[http://community.casiocalc.org/topic/7183-help-needed-calculator-benchmark/|Source on Casio forum]]))
 +    * Count: 
 +      * 6'921'042 overclocked to 94.3MHz (max overclocking without freezing)
 +      * 4'685'089 @58mhz with some improvements on keyupdate [[http://community.casiocalc.org/topic/7183-help-needed-calculator-benchmark/page__st__40#entry58786|Flyingfisch]]
 +      * 4'246'899 default 58Mhz
 +    * Note: AC/on displays value of int i, MENU exits
 +    * Code: see the note ((<code c>
 +#include <display_syscalls.h>
 +#include <keyboard_syscalls.h>
 +#include <keyboard.hpp>
 +#include <color.h>
 +
 +// Getkey routine
 +const unsigned short* keyboard_register = (unsigned short*)0xA44B0000;
 +unsigned short lastkey[8];
 +unsigned short holdkey[8];
 +
 +void keyupdate(void) {
 +  memcpy(holdkey, lastkey, sizeof(unsigned short)*8);
 +  memcpy(lastkey, keyboard_register, sizeof(unsigned short)*8);
 +}
 +int keydownlast(int basic_keycode) {
 +  int row, col, word, bit;
 +  row = basic_keycode%10;
 +  col = basic_keycode/10-1;
 +  word = row>>1;
 +  bit = col + 8*(row&1);
 +  return (0 != (lastkey[word] & 1<<bit));
 +}
 +int keydownhold(int basic_keycode) {
 +  int row, col, word, bit;
 +  row = basic_keycode%10;
 +  col = basic_keycode/10-1;
 +  word = row>>1;
 +  bit = col + 8*(row&1);
 +  return (0 != (holdkey[word] & 1<<bit));
 +}
 +
 +int main() {
 +  int i=0;
 +  int key;
 +  // clear screen
 +  Bdisp_AllClr_VRAM();
 +  while (1) {
 +    keyupdate();
 +    // increment i
 +    i++;
 +    if (keydownlast(KEY_PRGM_ACON)) {
 +      char buffer[10];
 +      strcpy(buffer," ");
 +      itoa(i, buffer+2);
 +      PrintXY(1,1,buffer,0,COLOR_BLACK);
 +      Bdisp_PutDisp_DD();
 +    }
 +     // handle [menu]
 +     if (keydownlast(KEY_PRGM_MENU)) {
 +     GetKey(&key);
 +    }
 +  }
 +
 +  return 1;
 +}
 +</code>))
 +  - HP48G/GX/G+ version R ROM models Saturn ASM -- 8x loop unrolling
 +    * Count: 6,784,080 (([[https://www.hpmuseum.org/forum/thread-20714.html|Jonathan Busby and others on the HP Museum forum]]))
 +    * <code> 
 +        C=0     W
 +        P=      5
 +        l1      C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GONC    l1
 +l2      C=C+1   P
 +        GONC    l1
 +</code>
 +    * Code: ((<code>ASSEMBLE
 +        NIBASC /HPHP48-R/
 +RPL
 +
 +
 +CODE
 +cbcnfgrtn EQU #99CD
 +cartn EQU #1C3D
 +uncnfgrtnl EQU #7C027
 +uncnfgrtnh      EQU     #805F9
 +cnfgrtnl EQU #99CF
 +cnfgrtnh        EQU     #805CF
 +
 +*X1          EQU 1
 +*X4          EQU 1
 +*X8          EQU 1
 +
 +        GOSBVL  =SAVPTR
 +        GOSBVL  =DisableIntr * Can't have an interrupt while IRAM is in the process of being reconfigured, it'                    
 +                             * not at address #80000 or if it's temporarily malformed due to the ISR code
 +        GOSBVL  =DispOff     * Turn off the display
 +              
 +        D0=(5) =IRAMMASK    * Get size mask for IRAM and save it
 +        A=DAT0 A
 + R4=A 
 +        GOSUB   end_isr      * Push address of ISR to the hardware return stack...
 +start_isr
 +        ST=0    0
 +        GONC    chktimer     * No carry detected -- leave ST.0 set to 0
 +        ST=1    0            * Carry detected -- set ST.0 to 1
 +chktimer
 +        D0=(5)  =TIMERCTRL.2
 + A=DAT0  1            * Check if TIMER2 requires service
 + ?ABIT=1 3               
 + GOYES   done         * If so we're done... ( branch back to cleanup code in IRAM )
 +        ?ST=1   0
 +        GOYES   cry1         * Preserve carry of interrupting code 
 +cry1    RTI                  * Return and re-enable interrupts
 +done    ?ST=0   0
 +        GOYES   nocarry
 +        C=C+1              * Adjust count as we've interrupted the add loop after C.A overflows
 +nocarry 
 +        R2=C                 * save count
 +        CD1EX                * retrieve return address and save it to RSTK
 +        RSTK=C
 +        CD1EX
 +        RTN                  * We're done -- branch back
 +end_isr
 +         
 +        C=RSTK               * Grab address of ISR code
 +        LA(5)   #80000       * Adjust address for post IRAM reconfiguration
 +        C=C-A   A
 +        D0=(5)  #8000F       * Address of ISR in IRAM before reconfiguration
 +        A=DAT0  7            * Save contents of RAM
 +        R0=A
 +        LA(2)   #D8          * Write GOVLNG with address of ISR as target
 +        DAT0=A  2
 +        D0=D0+  2
 +        DAT0=C  A
 +        GOSUB   ++           * Grab return address of code to which to transfer control after IRAM reconfiguration
 +-       GOTO    + 
 +++      C=RSTK               * Retrieve address of the previous instruction
 +        R3=C                 * And save unadjusted address...
 + LAHEX #80000       *
 + C=C-A A            * Adjust address...
 +        RSTK=C               * Save return address of post reconfigure code to return stack
 +
 +        LC(5)   #80000       * Current address of IRAM
 +        D=C                * save it...
 +        C=R4                 * Size mask...
 +        B=C                * Used by cbcnfgrtn
 +        A=0                * New address is #00000
 +
 +magic1                       * "magic" IRAM reconfiguration sequence...
 +        LC(5)   cnfgrtnh
 +        RSTK=C
 +        LC(5)   cartn
 +        RSTK=C
 +        LC(5)   cbcnfgrtn
 +        RSTK=C
 +        LC(5)   uncnfgrtnl
 +        RSTK=C
 +        C=D     A
 +        RTN
 +magic2
 +        LC(5)   cnfgrtnl
 +        RSTK=C
 +        LC(5)   cartn
 +        RSTK=C
 +        LC(5)   cbcnfgrtn
 +        RSTK=C
 +        LC(5)   uncnfgrtnh
 +        RSTK=C
 +        C=D     A
 +        RTN        
 ++       
 +*        D0=(5)  =TIMERCTRL.2 * Save TIMER2 control reg value
 +*        A=DAT0  S
 +*        R1=A.F  S
 +        GOSUB   WaitForTick  * Wait for TIMER2 to decrement
 +        P=      7            * Save TIMER2 value
 +        A=DAT0  WP           *
 +        R1=A.F  WP
 +        D0=(5)  =TIMER2      * Set up 60 second TIMER2 countdown
 +        A=0     W
 +        P=      0
 +        LA(5)   #78000
 +*        LA(5)   #2000        * 1 second countdown for debugging purposes...
 +        P=      7
 +        DAT0=A  WP
 +        P=      0
 +        D0=(5)  =TIMERCTRL.2 * Enable TIMER2 interrupts
 +        LA(1)   3
 +        DAT0=A  1
 +        
 +        GOSUB   c1           * Control returns here if TIMER2 requires service and branches to cleanup
 +        GOTO    cleanup
 +c1      C=RSTK      
 +        D1=C                 * Save post-ISR branch address in D1
 +        
 +        C=0                * Set up regs for inner add loop
 +        P=      5
 +        GOSUB              * re-enable interrupts
 +        GOTO    ++
 ++       RTI
 +++      
 +*       GOSBVL   #0000F      * Debugging
 +** The following first inner add loop code was written by Werner **
 + 
 +        IFDEF   X1
 +l1      C=C+1   A
 +        GONC    l1
 +        C=C+1   P
 +        GONC    l1
 +        ENDIF
 +        
 +        IFDEF   X4           * Unrolled x4
 +l1      C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GONC    l1
 +l2      C=C+1   P
 +        GONC    l1
 +        ENDIF
 +        
 +        IFDEF   X8           * Unrolled x8
 +l1      C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GOC     l2
 +        C=C+1   A
 +        GONC    l1
 +l2      C=C+1   P
 +        GONC    l1
 +        ENDIF
 +        
 +cleanup                      * The ISR returns control here when TIMER2 underflows       
 +        P=      0
 +        A=R3                 * Retrieve original return address
 +        LC(5)   (end)-(-)    * Load offset of "end" label
 +        C=C+A              * Add to original address to get address of end
 +        RSTK=C               * Save end return address to return stack...
 +        C=0                * Current IRAM address...
 +        D=C                * Save it...
 +        C=R4    A            * Size mask...
 +        B=C                * Used by cbcnfgrtn
 +        LA(5)   #80000       * New IRAM address...
 +        GOTO    magic2       * Reconfigure IRAM back to its normal size and location...
 +
 +end                          * Control returns to here after second IRAM reconfiguration...
 +        A=R0                 * Retrive previous contents of IRAM at #8000F
 +        D0=(5)  #8000F
 +        DAT0=A  7            * Restore previous contents of IRAM
 +        GOSUB   WaitForTick  * Wait for TIMER2 to decrement before restoring system time
 +        P=      7            * Recall saved TIMER2 value
 +        A=R1.F  WP
 +        P=      0
 +        LC(5)   #78000       * Adjust TIMER2 value to account for 60 second countdown
 +*        LC(5)   #2000        * 1 second countdown for debugging purposes
 +        A=A-C   WP
 +        DAT0=A  WP           * Restore correct TIMER2 value
 +        P=      0
 +*        D0=(5)  =TIMERCTRL.2 * Restore TIMER2 control reg value
 +*        A=R1.F  S
 +*        DAT0=A  S
 +        GOSBVL  =AllowIntr
 +        GOSBVL  =DispOn      * Turn the display back on...
 +        A=R2                 * Retrieve count saved in ISR
 +        P=      15
 +        GOVLNG  =PUSHhxsLoop * Push it to the stack and loop
 +        
 +* Utility subroutine that waits for TIMER2 to decrement
 +WaitForTick
 +    D0=(5)  =TIMER2
 +    P=      7
 +    C=DAT0  WP
 +    D=C     WP
 +-   C=DAT0  WP
 +    ?D=C    WP
 +    GOYES   -
 +    RTN
 +ENDCODE</code>))
 +  - Hp50g Saturn ASM
 +    * Count: 6,469,858 OS version 2.15 with HPGCC3 patch 75MHz. (([[http://community.casiocalc.org/topic/7183-help-needed-calculator-benchmark/#entry58749|by 3298 on casio forum]]))
 +    * <code>
 +CODE
 +GOSBVL SAVPTR
 +D0=80EAB ;ATTNFLG
 +A=0.W
 +*loop
 +A+1.W
 +C=DAT0.A
 +?C=0.A
 +GOYES *loop
 +GOSBVL GETPTR
 +P=15
 +GOVLNG PUSHhxsLoop
 +ENDCODE
 +</code>
 +  - Prime: v2013.8.13
 +    * Count: 6,646,300
 +    * <code modula2>
 +export LOOP()
 +begin
 + A:=0;
 + for A from 1 to 1E9 do
 + end;
 +end;
 +</code>
 +Recall A after ON to stop running on 1 min. Average of several runs.
 +  - HP48G/GX/G+ version R ROM models Saturn ASM
 +    * Count: 4,383,185 (([[https://www.hpmuseum.org/forum/thread-20714.html|Jonathan Busby and others on the HP Museum forum]]))
 +    * <code>
 +        P=      5
 +        C=0     W
 +l1      C=C+1   A
 +        GONC    l1
 +        C=C+1   P
 +        GONC    l1
 +</code>
 +  - HP-71B USA:2504A00223 HP71:1BBBB FTH:1A, year of production 1984? 
 +    * Count: 1,069,543  
 +    * Code: see the note ((<code> 
 +Forth + Assembler: ADD1 D.
 +
 +Press any key (except ON) to stop counting. 
 +Count => double length value on the stack.
 +
 +First assemble ADD1 into the Forth dictionary:
 +
 +File: ADD1   
 +FORTH   
 +WORD 'ADD1' 
 +** overflows in about 470 secs .... P= xx where xx>6 gives more time   
 +P= 6   
 +C=0 A   
 +A=0 WP 
 +LOOP A=A+1 WP   
 +C=IN         // Keyboard touched (except ON key !)   
 +?C=0 A   
 +GOYES LOOP   
 +D1=D1- 5   
 +DAT1=A A   
 +ASR W   
 +ASR W   
 +ASR W   
 +ASR W   
 +ASR W   
 +D1=D1- 5   
 +DAT1=A A   
 +RTNCC   
 +END
 +</code>))
 +  - Hp39gII 
 +    * Count: 1,062,108 (([[http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/forum.cgi?read=250044#250042| by Gilles Carpentier on 11 Sept 2013]]))
 +    * <code modula2 >
 +EXPORT LOOP()
 +BEGIN
 + A:=0;
 + FOR A FROM 1 TO 1E9 DO END;
 +END;
 +</code>
 +    * Count: ~640,000 (([[http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv021.cgi?read=219351#219391|Source]]))
 +    * <code modula2 >
 +EXPORT ADDLOOP()
 +BEGIN
 +  A:=0;
 +  REPEAT
 +    A:=A+1;
 +  UNTIL 0;
 +END;
 +</code>
 +  - Casio fx-CG 10 PRIZM, OS version 01.04.3200, LuaZM (([[http://community.casiocalc.org/topic/7183-help-needed-calculator-benchmark/|Source on Casio forum]]))
 +    * Count: 893207 sec overclocked to 94.3MHz (max overclocking without freezing
 +    * Count: 547223 sec default 58Mhz
 +    * Note: When running this code, note that it breaks when AC/on is pressed. I used the fastest Getkey routine for PRIZM, I may try a test directly polling the RTC in the future.
 +    * <code>
 +zmg.keyDirectPoll()
 +for i=1,100000000000 do
 +  zmg.keyDirectPoll()
 +    if zmg.keyDirect(10)>0 then print(i) break end
 +end
 +</code>
 +  - HP 30b with TSTSYS ON
 +    * Count: 531,131
 +    * <code> 
 +LBL 00 ISG 0 Stop GOTO 00, with 0 pre-stored in 0. Result indicates count of loops in one minute. Each loop adds 1 to value in memory 0.
 +(as first program in memory)
 +</code>
 +  - HP 30b (([[http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv020.cgi?read=186674#186755|Source]]))
 +    * Count: ~415.000 with crystal enabled, 340.000 without
 +    * <code>
 +INC X
 +BACK 01
 +</code>
 +  - DM42 -USB connected screen turned off. RPN
 +    * Count: 373,166 (([[https://www.hpmuseum.org/forum/thread-20714.html|Gjermund Skailand and others on the HPmuseum forum]]))
 +    * <code>
 +01 LBL "xxx"
 +02 "RefLCD"
 +03 ASTO ST L
 +04 RCL IND ST L
 +05 STO 00
 +06 0 STO IND ST L
 +07 1E7
 +08 ENTER
 +09 LBL 00
 +10 DSE ST X
 +11 GTO 00
 +12 ASTO ST L
 +13 RCL 00
 +14 STO IND ST L
 +15 END
 +</code>
 +  - FX-9860G SD  Fast Mode 
 +    * Count: 370,230 
 +    * Code: ''Lbl 0 : Isz A : Goto 0'' 
 +  - HP 34s Build 1099
 +    * Count: 272,538
 +    * Code: ''LBL A, +, BACK 01''
 +  - FX-9860G SD Fast Mode
 +    * Count: 237,780 
 +    * Code: ''Lbl 0 : Ans+1 : Goto 0''
 +  - HP 30b with TSTSYS ON
 +    * Count: 222,578
 +    * Code: ''LBL 00 + GOTO 00'' \\ (as first program in memory)
 +  - HP 30b with TSTSYS ON
 +    * Count: 209,038
 +    * Code: ''LBL 00 STO+0 GOTO 00'' with 0 pre-stored in 0 and 1’s filling the stack \\ (as first program in memory)
 +  - FX-9860G SD  Fast Mode 
 +    * Count: 206,250 
 +    * Code: ''0->A : Lbl 0 : A+1->A : Goto 0'' 
 +  - FX-9860G SD 
 +    * Count: 177,230 
 +    * Code: ''Lbl 0 : Isz A : Goto 0''
 +  - HP 50g (SysRPL bint)
 +    * Count: 153,421 OS version 2.15 with HPGCC3 patch 75MHz.(([[http://community.casiocalc.org/topic/7183-help-needed-calculator-benchmark/#entry58749|by 3298 on casio forum]]))
 +    * Code: '':: BINT0 BEGIN #1+ ATTN? UNTIL UNCOERCE ;''
 +    * Count: 124,445 
 +    * Code: ''!NO CODE !RPL :: ZERO BEGIN #1+ GETTOUCH UNTIL DROP ; @''
 +  - FX-9860G SD
 +    * Count: 110,140
 +    * Code: ''Lbl 0 : Ans+1 : Goto 0''
 +  - FX-9860G SD 
 +    * Count: 97,950 
 +    * Code: ''0->A : Lbl 0 : A+1->A : Goto 0''
 +  - WP 34s Stack depth 4
 +    * <code>
 +LBL'XYZ' + GTO'XYZ'             90891
 +LBL A    + GTO A                90675
 +LBL 00   + GTO 00               90369
 +</code>
 +  - Casio fx-CG 10 PRIZM with CASIO-BASIC (([[http://community.casiocalc.org/topic/7183-help-needed-calculator-benchmark/|Source on Casio forum]]))
 +    * note: Timing done by hand with a stopwatch, may be off by as much as half a second.
 +    * Count: 85074 overclocked to 94.3MHz, OS version 01.04.3200
 +    * <code>
 +For 1->I To 1000000000
 +Next
 +    </code>  
 +    * Count: 54006 overclocked to 94.3MHz (max overclocking without freezing), OS version 01.04.3200
 +    * <code>
 +0->S run in Run-Mat before timing
 +While 1
 +Isz S
 +WhileEnd
 +    </code> 
 +    * Count: 51844 clocked at default 58MHz, OS version 01.04.3200
 +    * <code>
 +For 1->I To 1000000000
 +Next
 +    </code> 
 +    * Count: 33012 clocked at default 58MHz, OS version 01.04.3200
 +    * <code>
 + 0->S run in Run-Mat before timing
 + While 1
 + Isz S
 + WhileEnd
 +    </code>
 +    * Count: 22658 clocked at default 58MHz, OS version 01.04.3200
 +    * <code>
 +0->S
 +While 1
 +S+1->S
 +WhileEnd
 +    </code>
 +  - HP 12c+
 +    * Count: 78,640
 +    * Code: ''+ GTO 01''
 +  - WP 34s Stack depth 8
 +    * <code>
 +LBL 00   + GTO 00               78209
 +</code>
 +  - HP 30b
 +    * Count: 72,517
 +    * Code: ''LBL 00 + GOTO 00'' \\ (as first program in memory)
 +  - HP 9825 B
 +    * Count: 59,568
 +    * Code: ''0->A; "start"; A+1->A; gto "start"; end''
 +  - HP 15c le
 +    * <code>
 ++ x=0? 59006 or 59182
 +ISG 00 41062 or 41048
 +ISG  I 40746
 +ISG .9 40922
 +</code>
 +  - HP 50g (SysRPL floating point) 
 +    * Count: 56,994 
 +    * Code: ''!NO CODE !RPL :: BEGIN %1+ GETTOUCH UNTIL DROP ; @''
 +  - Casio fx-9860G Slim
 +    * Count: 55,924
 +    * Code: ''0->A Lbl 0 A+1->A Goto 0''
 +  - HP-9100A SERIAL NUMBER 816-01071 (1971?)
 +    * Count: 49,391
 +    * Code: ''+, GO TO 00''
 +  - hp 15c le stopped by hand, maybe 2 s +/-
 +    * Count: ~ 48,000
 +    * <code>
 +LBL  E + GTO  E 48823
 +LBL 09 + GTO 09 48763
 +LBL  A + GTO  A 48721
 +LBL 01 + GTO 01 48509
 +LBL .9 + GTO .9 44448
 +LBL .1 + GTO .1 44083
 +</code>
 +  - HP 9815S
 +    * Count: 47,592
 +    * Code: ''000 +  001 GOTO 000''
 +  - HP-9100B
 +    * Count: 47,394
 +    * Code: ''+, GO TO, 0, 0''
 +  - HP-71B Forth Xerxes:
 +    * COUNT: 46,575 
 +    * <code>
 +Forth
 +: XERXES 1 SWAP 0 DO 1+ LOOP ;
 +46575 XERXES DROP
 +BYE
 +</code>
 +  - HP 50g
 +    * Count: 31,849
 +    * Code:  ''1. << DO 1. + UNTIL 0. END >>''
 +  - HP 9815A/S
 +    * Count: 31,156
 +    * Code; ''LBL, A, 1, +, GTO A''
 +  - HP 48gII Exact mode (old version)
 +    * Count: 28,160
 +    * Code: ''1. << DO 1. + UNTIL 0. END >> EVAL''
 +  - HP 48gII
 +    * Count: 26,439 //Approx Mode//
 +    * Code: ''<< WHILE 1 REPEAT 1. + END >>''
 +  - TI-83+ SE
 +    * Count: 24,840
 +    * Code: ''Lbl 0 : Ans+1 : Goto 0''
 +  - HP 85
 +    * Count: 23,605
 +    * Code: ''10 Let A=0; 20 Let A=A+1; 30 goto 20; 40 END''
 +  - Sharp EL-9900
 +    * Count: 23,483
 +    * Code: ''Label X   A+1=>  Goto X''
 +  - HP-75C (1982)
 +    * Count: 21,717
 +    * Code: ''&#8232;10 A=0&#8232;20 A=A+1 @ GOTO 20&#8232;30 END''
 +  - TI-81 
 +    * Count: 20,191 
 +    * Code: ''Lbl A : Ans + 1 : Goto A : End''
 +  - TI-83
 +    * Count: 19,020 (([[http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv019.cgi?read=168663|Loops of addition improved results]]))
 +    * Code: '':For(I,1,99999) :End''
 +    * Count: 12,986 
 +    * Code: ''Lbl B: ans +1: goto B''
 +  - Casio fx-9750G Plus rom 1.00 @ 4mhz with CASIO-BASIC (([[http://community.casiocalc.org/topic/7183-help-needed-calculator-benchmark/#entry58749|Source on Casio forum]]))
 +    * note: Timing done by hand with a stopwatch, may be off by as much as half a second. 
 +    * Count: 16526
 +    * <code>
 +0->S run in Run-Mat before timing
 +While 1
 +Isz S
 +WhileEnd
 +    </code> 
 +    * Count: 7561
 +    * <code>
 +0->S
 +While 1
 +S+1->S
 +WhileEnd
 +    </code>
 +  - TI-85 
 +    * Count 15,490 (([[http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv019.cgi?read=168663|Loops of addition improved results]]))
 +    * Code: '':For(I,1,99999) :End''
 +    * Count 11,100 
 +    * Code: ''Lbl A : Ans + 1 : Goto A : End''
 +  - Casio FX-7500G
 +    * Count: 15,364
 +    * Code: ''Lbl 1  Isz A  Goto 1''
 +  - HP 9810A
 +    * Count: 15,355
 +    * Code ''LBL, 1, +, GTO, 1''
 +  - TI-81 
 +    * Count: 15,116 
 +    * Code: ''Lbl A : B + 1 > B : Goto A : End''
 +  - TI-84 Silver Edition
 +    * Count: 13,838
 +    * Code: ''Lbl 1:A+1->A: Goto 1''
 +  - Casio Algebra FX 2.0 rom 1.05 clock around 24 mhz (([[http://community.casiocalc.org/topic/7183-help-needed-calculator-benchmark/#entry58749|Source on Casio forum]]))
 +    * note: Timing done by hand with a stopwatch, may be off by as much as half a second. 
 +    * Count: 12941 
 +    * <code>
 +0->S run in Run-Mat before timing
 +While 1
 +Isz S
 +WhileEnd
 +    </code> 
 +    * Count: 8115 
 +    * <code>
 +0->S
 +While 1
 +S+1->S
 +WhileEnd
 +    </code>
 +  - TI-86 
 +    * Count 12,690 (([[http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv019.cgi?read=168663|Loops of addition improved results]]))
 +    * Code: '':For(I,1,99999) :End''
 +    * Count 5,347 
 +    * Code: ''Lbl A : Ans + 1 : Goto A : End''
 +  - TI-89 Titanium (HW 4, AMS 3.10) patched with tiosmod/amspatch
 +    * note: I reran the TI-89t tests because there are evidently more variables influencing the benchmark results than I realized. The last test was in a folder with various variables in it and other stuff on the home screen. I did the test again from an empty folder and a completely cleared home screen and got these results. (([[http://www.cemetech.net/forum/viewtopic.php?p=208643#208643|By Travis on cemetech]]))
 +    * Count: 
 +      * In AUTO mode: 12655.33 avg.
 +      * In EXACT mode: 12649.67 avg.
 +      * In APPROX mode: 4958.33 avg.
 +    * Code: ''For x,1,9999999999:EndFor''
 +    * Count:
 +      * In AUTO mode: 12372.33 avg.
 +      * In EXACT mode: 12335.33 avg.
 +      * In APPROX mode: 8591.33 avg.
 +    * Code: ''0→x:Loop:x+1→x:EndLoop''
 +    * Count:
 +      * In AUTO mode: 12133  avg.
 +      * In EXACT mode: 12149.33  avg.
 +      * In APPROX mode: 8571.33 avg.
 +    * Code: ''0→x:While true:x+1→x:EndWhile''
 +    * Count:
 +      * In AUTO mode: 11072 avg.
 +      * In EXACT mode: 12149  avg.
 +      * In APPROX mode: 8081 avg.
 +    * Code: ''0→x:Lbl a:x+1→x:Goto a''
 +  - HP 49G
 +    * Count: 12,351
 +    * Code:  ''1. << DO 1. + UNTIL 0. END >>''
 +  - TI CC-40 (([[http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv019.cgi?read=168663|Loops of addition improved results]]))
 +    * Count: 12,110
 +    * Code: ''10 FOR I = 1 TO 99999 20 NEXT I''
 +  - The NEWT 41CL logic board upgrade for the HP 41. 
 +    * Code: ''LBL 00 + GTO 00''
 +    * <code>
 +1X mode: 1,055
 +2X Turbo mode: 1,913
 +5X Turbo mode: 4,153
 +10X Turbo mode: 6,538
 +20X Turbo mode: 9,179
 +50X Turbo mode: 12,022
 +</code>
 +  - HP 48GX 
 +    * Count: 11,636 
 +    * Code: ''<< WHILE 1 REPEAT 1 + END >>''
 +  - TI-89 Titanium (HW **2**, AMS **2.08**) patched with tiosmod/amspatch
 +    * note: I reran the TI-89t tests because there are evidently more variables influencing the benchmark results than I realized. The last test was in a folder with various variables in it and other stuff on the home screen. I did the test again from an empty folder and a completely cleared home screen and got these results. (([[http://www.cemetech.net/forum/viewtopic.php?p=208643#208643|By Travis on cemetech]]))
 +    * Count:
 +      * In AUTO mode: 11428 avg.
 +      * In EXACT mode: 11436 avg.
 +      * In APPROX mode: 8156 avg.
 +    * Code: ''0→x:Loop:x+1→x:EndLoop''
 +    * Count:
 +      * In AUTO mode: 11174  avg.
 +      * In EXACT mode: 11185 avg.
 +      * In APPROX mode: 8019 avg.
 +    * Code: ''0→x:While true:x+1→x:EndWhile''
 +    * Count: 
 +      * In AUTO mode: 10666 avg.
 +      * In EXACT mode: 10692 avg.
 +      * In APPROX mode: 4295 avg.
 +    * Code: ''For x,1,9999999999:EndFor''
 +    * Count:
 +      * In AUTO mode: 10266 avg.
 +      * In EXACT mode: 11185  avg.
 +      * In APPROX mode: 7521 avg.
 +    * Code: ''0→x:Lbl a:x+1→x:Goto a''
 +  - Casio Fx 5800
 +    * Source: [[http://community.casiocalc.org/topic/7183-help-needed-calculator-benchmark/page-2#entry59054|Discussion on casiocalc.org]]
 +    * Count: 11,230 
 +    * <code>
 +0->S
 +Lbl 0
 +Isz S
 +Goto 0
 +</code>
 +  - HP 49G 
 +    * Count: 11,041 
 +    * Code: ''<< WHILE 1. REPEAT 1. + END >>''
 +  - Psion Organiser II CM (1997)
 +    * Count: 10,949
 +    * Code: ''&#8232; LOCAL a&#8232;a=1&#8232;DO&#8232;a=a+1&#8232;UNTIL KEY$="S"&#8232;PRINT a&#8232;GET''
 +  - HP-48G
 +    * Count: 10,726
 +    * Code: ''<< WHILE 1 REPEAT 1 + END >>''
 +  - Casio FX-7500G
 +    * Count: 10,692 
 +    * Code: ''Lbl 1 Ans+1 Goto 1''
 +  - TI-83+ 
 +    * Count 10,385
 +    * Code: ''Lbl A : Ans + 1 : Goto A : End''
 +  - HP 33s
 +    * Count: 10,097
 +    * Code: ''LBL A + GTO A''
 +  - TI CC-40 
 +    * Count: 9,339 
 +    * Code: ''10 A = A+ 1 : 20 GOTO 10''
 +  - TI-89 Titanium
 +    * Count: 9,339
 +    * Program: ''aa():Prgm:Lbl b:a+1->a:Goto 1: EndPrgm''
 +  - Sharp EL-5500III (([[http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv019.cgi?read=168663|Loops of addition improved results]]))
 +    * Count: 9,140
 +    * Code: ''10 FOR I = 1 TO 9999 : 20 NEXT I''
 +  - Casio FX-7500G
 +    * Count: 8,878
 +    * Code: ''Lbl 1   A+1->  Goto 1''
 +  - TI-83
 +    * Count: 8,106
 +    * Code: ''LBL B, A+1>>A, goto B''
 +  - Casio FX-7500G
 +    * Count: 8,105
 +    * Code: ''0-> Lbl 1  A+1-> Goto 1''
 +  - Casio fx-7000GB
 +    * Result: 7,437
 +    * Code: ''LbL 1; A+1->A; Goto A''
 +  - HP-48SX
 +    * Count: 7,352
 +    * Code: Unknown
 +  - FX-603P
 +    * Count: 7,240 
 +    * Code: ''AC 1 + + LBL 0 = GOTO 0''
 +  - HP-42s FAST MODE S/N 2849A with goose disabled
 +    * Count: 6,485
 +    * Code: ''CLLCD LBL 01 + GTO 01''
 +  - HP-32s
 +    * Count: 5,973
 +    * Code: ''LBL A + GTO A''
 +  - TI-92
 +    * Count: 5,686
 +    * Code: ''0-> Lbl aa  a+1-> Goto aa''
 +  - HP-28S 
 +    * Count: 5,677 
 +    * Code: ''HOME 1 << WHILE 1 REPEAT 1 + END >> EVAL''
 +  - HP 50G (normal speed)
 +    * Count: 5,510
 +    * Code: ''<< 1 + A >> stored in A, start with 1 on stack line 1:''
 +  - HP 35s
 +    * Count: 5,504
 +    * Code: ''B001 LBL B B002 STO+ Z B003 GTO B002, with Z initialized to 0''
 +  - FX-5800P
 +    * Count: 5,340
 +    * Code: ''Lbl 0 : Ans+1 : Goto 0''
 +  - PC-1247 
 +    * Count: 5,180 
 +    * Code: ''1:A=A+1:GOTO1''
 +  - HP 20S
 +    * Count: 4,837
 +    * Code: ''LBL A, +, GTO A''
 +  - HP-32sii
 +    * Count: 4,715
 +    * Code: ''LBL A, +, GTO A''
 +  - HP-42s FAST MODE S/N 2849A
 +    * Count: 4,419
 +    * Code: ''LBL 01 + GTO 01''
 +  - HP-71B
 +    * Count: 4,320
 +    * <code>
 +10 DESTROY A @ A=0
 +20 ON TIMER #1,60 GOTO 40
 +30 A=A+1 @ GOTO 30
 +40 DISP A
 +</code>
 +  - HP 48gII (Original 3 batteries, NO USB)
 +    * Count: 4,296 
 +    * Code: ''<< TICKS 8192 60 * + << -> t << DO 1. + UNTIL TICKS t >= END >> >> EVAL >>''
 +  - HP-20S
 +    * Count: 4,170
 +    * Code: Unknown
 +  - HP 35s
 +    * Count: 3,652
 +    * Code: ''LBL B, +, GTO B001''
 +  - TI-86 
 +    * Count: 3,612 
 +    * Code: ''Lbl B:1+A->A:Goto B''
 +  - HP 39gs
 +    * Count: 3,607
 +    * Code: ''1->A:  DO  A+1-> UNTIL A<=0  END:''
 +  - Aurora HP 12c clone
 +    * Count: 3,554
 +    * Code:  ''+, GTO 01''
 +  - TI-95
 +    * Count: 3,350 counts 
 +    * Code: ''1 + GTO 0000'' 
 +  - Radio Shack PC-2
 +    * Count: 3,317
 +    * Code: ''1: A=A+1 2: GOTO 1 ; start with 0 stored in A.''
 +  - Casio fx602p
 +    * Count: 3,111
 +    * Code: ''AC 1++ LBL1 = GOTO1''
 +  - Sharp EL-9650
 +    * Count: 3,093
 +    * Code: ''Label X   A+1=>  Goto X''
 +  - HP 48gII (Original 3 batteries, NO USB)
 +    * Count: 3,088 
 +    * Code: ''<< WHILE 1 REPEAT 1. + END >>''
 +  - TI-80 
 +    * Count 3,080 (([[http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv019.cgi?read=168663|Loops of addition improved results]]))
 +    * Code: '':For(I,1,99999) :End''
 +    * Count 2,279 
 +    * Code: ''Lbl A : Ans + 1 : Goto A : End''
 +  - HP-42S with "goose" disabled. Non-fast mode.
 +    * Count: 3,067
 +    * Code: ''CLLCD, LBL 00 + GTO 00''
 +  - HP 48gii Exact mode (Original 3 batteries, NO USB)
 +    * Count: 3,036
 +    * Code: ''<< WHILE 1 REPEAT 1 + END >>''    
 +  - HP-42S
 +    * Count: 2,115 
 +    * Code: ''LBL 00 + GTO 00''
 +  - Sharp EL-5500III
 +    * Count: 2,056
 +    * Code: ''1 A=A+1: GOTO 1''
 +  - DM-15cc
 +    * Count max: 2038
 +    * <code>
 +000 +
 +001 x=0
 +Just fill the stack with 1s and hit the R/S key. 
 +For this to work all the programs have to be cleared beforehand. 
 +Another variant is to start with 0 in register I and use this program:
 +
 +000 ISG I
 +The results are 2038 and 1669 using a DM-15CC. 
 +</code>
 +  - HP-41CY Turbo
 +    * Count: 1,982
 +    * Code: ''LBL 00, +, GTO 00''
 +  - Sharp EL-5500II
 +    * Count: 1,510
 +    * Code: ''1 A=A+1: GOTO 1''
 +  - HP 9G
 +    * Count: 1,470
 +    * Code: ''A=0; Lbl 0=; A=A+1; GOTO 0; END ''
 +  - HP 12c plat 25th anniv.
 +    * Count:  1,435
 +    * Code:  ''+, Goto 001''
 +  - HP 12c platinum
 +    * Count: 1,386
 +    * Code: ''+ GTO 001''
 +  - HP41CX Synthetic:
 +    * Count: 1,298    
 +    * <code>
 + 01 LBL "X”
 + 02 1
 + 03 "SeeRemark"
 +
 +
 +!!! Synthetic string 9 long Decimal 249 96 7 117 131 131 131 64 178 176
 +this places 96 7 in N to be transferred in reg b, resulting in 
 +program counter in reg M, byte 6. In reg M synthetic code results 
 +in: RDN ENTER ENTER ENTER + GTO 01. The GTO 01 is a COMPILED GTO 
 +jumping to the + before it! You can SST this code but the GTO 01 
 +takes a long time to reposition! Yes, this can be optimized still a 
 +bit, but the loop is using 3 bytes! 
 +
 +
 + 04 0
 + 05 X<> N
 + 06 BEEP
 + 07 STOP
 + 08 STO b
 + 09 END
 +
 +
 +INSTRUCTION: READ THIS
 +XEQ "X"
 +wait until beep, 000000,06 is displayed
 +press [R/S] to start counting
 +press [R/S] after 60 seconds, write down the count
 +perform a GTO .. !!! because the program pointer is in reg M, switching to program mode and TOUCHING A KEY results in MEMORY LOST!
 +</code>
 +  - CASIO PB-700
 +    * Count: 1,282 
 +    * Code: ''1: A=A+1 2: GOTO 1 ; start with 0 stored in A. ''
 +  - Sharp PC-1251
 +    * Count: 1,277
 +    * Code: ''1: A=A+1 2: GOTO 1 ; start with 0 stored in A.''
 +  - HP41CX:
 +    * Count 1,075
 +    * Code: ''LBL 01 + GTO 01''
 +  - HP 41c
 +    * Count: 1,063
 +    * Code: ''LBL 01 + GTO 01''
 +  - TI-59
 +    * Count: 635
 +    * Code:  ''1 + RST'' 
 +  - HP-65
 +    * Count:  578
 +    * Code:  ''Lbl 1, +, Goto 1''
 +  - HP-10C
 +    * Count: 514
 +    * Code: ''LBL 0 + GTO 0''
 +  - HP-25
 +    * Count: 512
 +    * Code: ''01 + 02 GTO 01''
 +  - TI-59 starting with 1 in the display 
 +    * Count: 501 
 +    * Code: ''SUM 00 RST''
 +  - HP 12c original (mfg. 1985)
 +    * Count: 500
 +    * Code: ''+; GTO 01''
 +  - TI-57
 +    * Count: 498
 +    * Code: ''+ 1 RST''
 +  - TI-59
 +    * Count: 492
 +    * Code: ''OP20 RST'' 
 +  - HP 25
 +    * Count: 483
 +    * Code: ''+ GTO 01''
 +  - TI SR-56
 +    * Count: 461
 +    * Code: ''+ 1 = RST''
 +  - TI SR-52
 +    * Count: 425
 +    * Code: ''+ 1 = RST''
 +  - HP-38C
 +    * Count: 387
 +    * Code:  ''+ GTO 01''
 +  - TI 58C
 +    * Count: 387
 +    * Code: ''+ 1 = RST''
 +  - Human hand Tapping + key
 +    * Count: 370 with m+ key on a sharp el506w
 +    * Count: 359 with touch calculator of Palm Treo Pro (windows mobile 6.1)
 +    * Count: 133
 +  - HP-29C 
 +    * Count: 361 
 +    * Code: ''LBL 0; +; GOTO 0''
 +  - SHARP PC-1211 
 +    * Count: 358 
 +    * Code ''1:Z=Z+1:GOTO 1 (starting with Z=0)''
 +  - HP 11c 
 +    * Count: 353 
 +    * Code: ''Lbl 1, +, Goto 1''
 +  - TI-59 
 +    * Count: 336 
 +    * Code: ''1 + GTO 000''
 +  - HP-33c (mfg. 1982) 
 +    * Count: 319 
 +    * Code: ''01 + 02 GTO 01''
 +  - HP 67 
 +    * Count: 349
 +    * Code: ''1 CHS STO I + GOTO (i)'' 
 +  - HP 55
 +    * Count: 312
 +    * Code: ''+ GTO 01''
 +  - HP-19c
 +    * Count: 301
 +    * Code: ''LBL 1 + GTO 1''
 +  - HP 15c (mfg. 1983)
 +    * Count: 297
 +    * Code: ''LBL A; +; GTO A''
 +  - HP 16c: 293 (float 4)
 +    * Count: 293
 +    * Code: ''LBL A + GTO A''
 +  - HP 34c: (I program) with -1 stored in I
 +    * Count: 277 
 +    * Code: ''LBL A + GTO f I''
 +  - HP 34c (mfg. 1981) 
 +    * Count: 269  
 +    * Code: ''LBL A; +; GTO A''
 +  - TI-55
 +    * Count: 267
 +    * Code: ''+ 1 RST''
 +  - HP 34c:
 +    * Count: 259
 +    * Code: ''LBL A + GTO A''
 +  - Odhner in hands of T. Klemm on 10 Sept 2013, 5:46 p.m.
 +    * Count: 251.
 +  - HP 16c
 +    * Count:  245
 +    * Code:  ''Lbl 1, +, Goto 1''
 +  - HP 16c: 230 (decimal, wsize 16, 2-complement)
 +    * Count: 230
 +    * Code: ''LBL A + GTO A''
 +  - HP 67
 +    * Count: 226
 +    * Code: ''LBL 1 + GTO 1''
 +  - HP-97 
 +    * Count: 223 
 +    * Code: ''LBL1; +; GOTO 1''
 +  - Texas Instrument TI-57LCD 
 +    * Count: 216 
 +    * Code: ''LBL_01 1 + GTO_01 ''
 +  - TI-66
 +    * Count: 210
 +    * Code: ''+ 1 = RST''
 +  - TI-65 
 +    * Count: 205 
 +    * Code: ''1 + RST''
 +  - Texas Instrument TI-57LCD 
 +    * Count: 195 
 +    * Code: ''1 + RST ''
 +  -TI-55
 +    * Count: 189
 +    * Code: ''+ 1 = RST''
 +  - TI BA 55
 +    * Count: 139
 +    * Code: ''+ 1 = RST''
 +  - Elektronika MK-61
 +    * Count: 106
 +    * Code: ''+ GSB 00''
 +  - TI-62 
 +    * Count: 100 
 +    * Code: ''1 + RST''
 +  - Commodore P50
 +    * Count: 97
 +    * Code: ''+ 1 = SKZ GOTO 00 R/S ( Start with -97 )''
 +  - TI-59 with RPN Module:
 +    * Count: 74
 +    * <code>
 +  HP-67 code: LBL 1 + 1 GOTO 1
 +  The RPN Module translated that to:
 +  LBL LNX PGM 51 A 1 PGM 12 A GTO LNX
 +  </code>
 +  
 +==== Needs confirmation ====
 +  - Casio fx-9860g Slim Compiled C program SDK V 1.0
 +    * Why does it need a confirmation?
 +      * [[http://tiplanet.org/forum/viewtopic.php?p=147882#p147882|Lionel Debroux observations]]: It doesn't know the value after 60 seconds, but it knows the value at the end of the loop, which is written in the code. For years, optimizing compilers have been able to recognize a number of loop idioms, especially such simple ones as <code>
 +do {
 +    counter++;
 +  } while (counter < 349700000);
 +</code> Such code is turned into <code>
 +counter = 349700000;
 +</code> by optimizing compilers; then, Dead Store Elimination will erase this assignment and the counter variable, since it's not used later. \\ Unless the compiler used for the fx-9860g absolutely stinks, or the benchmark is compiled without optimization, the program should print "end" immediately.
 +    * Note: Is it maybe in fast mode? (118mhz instead of 29)
 +    * Count: 349,700,000
 +    * <code c>
 +int AddIn_main(int isAppli, unsigned short OptionNum)
 +{
 +  unsigned int key;
 +  unsigned long int counter = 0;
 +  Bdisp_AllClr_DDVRAM();
 +  do {
 +    counter++;
 +  } while (counter < 349700000);
 +  locate(1,5);
 +  Print((unsigned char*)" end");
 +  while(1){
 +    GetKey(&key);
 +  }
 +
 +  return 1;
 +
 +</code>
 +  - HP-12C+, Scott’s custom integer firmware, overclocked to 48.75 MHz
 +    * Why does it need a confirmation?
 +      * There is no code about it
 +    * Count: 261,602,459 
 +    * Code: Unspecified
 +
 +===== Emulators on handheld/mobile devices =====
 +
 +**Notation**
 +  * Handheld device used - emulator used and version
 +  * The count after 60 seconds of execution 
 +  * The program code used.
benchmarks/addloop.txt · Last modified: 2023/11/06 07:27 by jdb2