Posted: 11:57pm 26 Apr 2025
Copy link to clipboard |
zeitfest Guru

|
|
|
I think many systems had a LOG (x) function where if x is an integer, some math tricks were used to simplify and speed it up, I will try to dig up some detail. BTW This is the benchmark (with the lines and structure kept as original as practical including go to-s) as approximated using f77ish interpreter. [I added a MILLI function.] The output times are in milliseconds. Running on a standard pico with sdcard and i2c keypad and lcd interface running. It is a bit slow but it has debugging etc stuff to clean up yet. Running
PROGRAM benchmarkdev INTEGER*4 j, a, q, ray(5) INTEGER*4 now, last, span DOUBLE b, c, d d = 1.123 C Benchmark 1 last = MILLI 1 DO 10 j = 1, 1000 10 CONTINUE now = MILLI 1 span = now - last PRINT *, "Benchmark 1 ", span C Benchmark 2 last = MILLI 1 j = 0 20 j = j + 1 IF ( j < 1000 ) GO TO 20 now = MILLI 1 span = now - last PRINT "Benchmark 2 ", span C Benchmark 3 last = MILLI 1 j = 0 30 j = j + 1 a = j/j*j+j-j IF ( j < 1000 ) GO TO 30 now = MILLI 1 span = now - last PRINT "Benchmark 3 ", span C Benchmark 4 last = MILLI 1 j = 0 40 j = j + 1 a = j/2*3+4-5 IF ( j < 1000 ) GO TO 40 now = MILLI 1 span = now - last PRINT "Benchmark 4 ", span C Benchmark 5 last = MILLI 1 j = 0 50 j = j + 1 a = j/2*3+4-5 CALL thesub ( ) IF ( j < 1000 ) GO TO 50 now = MILLI 1 span = now - last PRINT "Benchmark 5 ", span C Benchmark 6 last = MILLI 1 j = 0 60 j = j + 1 a = j/2*3+4-5 CALL thesub ( ) DO 65 q = 1, 5 65 CONTINUE IF ( j < 1000 ) GO TO 60 now = MILLI 1 span = now - last PRINT "Benchmark 6 ", span C Benchmark 7 last = MILLI 1 j = 0 70 j = j + 1 a = j/2*3+4-5 CALL thesub ( ) DO 75 q = 1, 5 ray(q) = a 75 CONTINUE IF ( j < 1000 ) GO TO 70 now = MILLI 1 span = now - last PRINT "Benchmark 7 ", span C Benchmark 8 last = MILLI 1 j = 0 80 j = j + 1 a = j ** 2 b = LOG (d) c = SIN (d) IF ( j < 1000 ) GO TO 80 now = MILLI 1 span = now - last PRINT "Benchmark 8 ", span END C C SUBROUTINE thesub ( ) RETURN END \
Benchmark 1 24 Benchmark 2 214 Benchmark 3 373 Benchmark 4 374 Benchmark 5 455 Benchmark 6 680 Benchmark 7 1111 Benchmark 8 610
OK
> |