N-Queens results on Casio calculators - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: Not HP Calculators (/forum-7.html) +--- Forum: Not remotely HP Calculators (/forum-9.html) +--- Thread: N-Queens results on Casio calculators (/thread-22065.html) Pages: 1 2 |
N-Queens results on Casio calculators - CalcLoverHK - 07-22-2024 08:03 PM Hey, I just registered here to share my results of N-Queens benchmark so far. Long story short, I did a research on how much performance GCC can achieve in floating-point and integer arithmetic, and compared that to the Renesas SHC compiler which is used by Casio C SDK. The Whetstone and Dhrystone tests concluded that GCC is theoretically faster than SHC in both areas. Reference: https://www.planet-casio.com/Fr/forums/topic17804-1-gcc-vs-renesas-shc-compiler.html To further confirm the performance uplift, I tried to port C.Basic FX 2.47-β2 to GCC with the help of Lephenixnoir, and run N-Queens C.Basic program under Integer Mode. Here are the results I got: fx-9860G Slim (Default): 0.639s fx-9860G Slim (Ftune F5 OC): 0.233s fx-9860GII-2 SD (Default): 0.539s fx-9860GII-2 SD (Ftune2 F5 OC): 0.0768s All of them are faster than the current best of their own category. I also did benchmark on fxSDK/gint + GCC: C / Unstructured fx-9860G Slim (-Os): 0.002306s fx-9860G Slim (-O2): 0.002264s fx-9860G Slim (-O3/-Ofast): 0.002040s fx-9860GII-2 SD (-Os): 0.001827s fx-9860GII-2 SD (-O2): 0.001960s fx-9860GII-2 SD (-O3/-Ofast): 0.002010s fx-9860GII-2 SD (-Os, Ftune2 F5 OC): 0.000227s C / Structured fx-9860G Slim (-Os): 0.002870s fx-9860G Slim (-O2): 0.002062s fx-9860G Slim (-O3/-Ofast): 0.001996s fx-9860GII-2 SD (-Os): 0.002498s fx-9860GII-2 SD (-O2): 0.001873s fx-9860GII-2 SD (-O3/-Ofast): 0.002028s fx-9860G Slim (-O3/-Ofast, Ftune F5 OC): 0.000555s RE: N-Queens results on Casio calculators - toml_12953 - 07-23-2024 06:11 AM (07-22-2024 08:03 PM)CalcLoverHK Wrote: Hey, I just registered here to share my results of N-Queens benchmark so far. This benchmark? https://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=700 RE: N-Queens results on Casio calculators - CalcLoverHK - 07-23-2024 08:56 AM (07-23-2024 06:11 AM)toml_12953 Wrote:(07-22-2024 08:03 PM)CalcLoverHK Wrote: Hey, I just registered here to share my results of N-Queens benchmark so far. Yes, though with a bit of modification on `printf("%d", s)` as I replaced it with gint's dprint() function. RE: N-Queens results on Casio calculators - xerxes - 07-24-2024 08:47 PM (07-22-2024 08:03 PM)CalcLoverHK Wrote: Hey, I just registered here to share my results of N-Queens benchmark so far. Some nice improvements and especially the C.BASIC result of the fx-9860GII-2 SD (Ftune2 F5 OC) is impressive. Thank you for the test results. RE: N-Queens results on Casio calculators - CalcLoverHK - 07-25-2024 07:09 PM (07-24-2024 08:47 PM)xerxes Wrote:(07-22-2024 08:03 PM)CalcLoverHK Wrote: Hey, I just registered here to share my results of N-Queens benchmark so far. Thanks for uploading my results, though I have a question on some of those on the benchmark thread: I tried to replicate the record of "C.BASIC 2.38 / Integer Mode / Fast Mode x7.0" using my fx-9860GII-2 SD, and so I assumed that fx-9750GII-2 was running under the Ftune2 F5 preset at the time of benchmarking, but it turned out my test result is actually faster (0.0939s) than this one (0.122s). Same for the C.BASIC 2.38 / Integer Mode record, where fx-9750GII-2 completes in 0.857s and mine only needs 0.661s even at default speed. Both calculators have the same CPU and so in theory they should have similar results. By the way, for SH3 assembly version my fx-9860GII-2 SD takes 0.00136s at default and 0.000169s under F5 OC. RE: N-Queens results on Casio calculators - xerxes - 07-25-2024 08:41 PM (07-25-2024 07:09 PM)CalcLoverHK Wrote: Both calculators have the same CPU and so in theory they should have similar results. Yes, in fact the C.BASIC results of the fx-9750GII-2 are too slow. An incorrect test code may have been used. I've removed them. Thanks for your help, making the list more accurate. RE: N-Queens results on Casio calculators - Hlib - 08-14-2024 10:23 AM A few comments about the "8-queens benchmark" program for CASIO calculators, a variant with Goto and Lbl. It is necessary to delete the useless Deg (or Rad) command and swap the two operators. The speed of calculations will not change at all, but the program code will look better. Code:
Here are the results for comparison. FX-9860GII-2, integer mode (CBASIC ver.2.45): t=0.661_sec without parentheses t=0.481_sec with parentheses (×1.4 times faster). RE: N-Queens results on Casio calculators - xerxes - 08-16-2024 12:06 AM (08-14-2024 10:23 AM)Hlib Wrote: Note that in CBASIC, the (X-Y)≠Abs T⇒Goto 2 command must have parentheses. Sentaro21 (the author of CBASIC) pointed out a long time ago that parentheses here provide compilation of elementary arithmetic expressions. I'm amazed about the speed difference with parentheses. Some languages do indeed have special characteristics that are not known to everyone. Can you please also test the FX-9860GII-2 with Ftune2 F5? I'll retest the FX-9860G with parentheses in the next days. RE: N-Queens results on Casio calculators - Hlib - 08-16-2024 03:22 PM (08-16-2024 12:06 AM)xerxes Wrote: Can you please also test the FX-9860GII-2 with Ftune2 F5? I'll retest the FX-9860G with parentheses in the next days.I have never used Ftune, so I cannot provide you with these results. Here is the fastest 8-queens benchmark version adapted exclusively for CBASIC: Code:
t=0.398_sec at 29.5_MHz. RE: N-Queens results on Casio calculators - xerxes - 08-17-2024 02:18 AM (08-16-2024 03:22 PM)Hlib Wrote: Here is the fastest 8-queens benchmark version adapted exclusively for CBASIC: Very nice. I'll update the list soon with your code. RE: N-Queens results on Casio calculators - xerxes - 08-20-2024 10:42 PM I've updated the list with the new C.BASIC test code from Hlib and removed the previous results. Now we have the FX-9860G SD with SH-3 and the FX-9860GII-2 with SH-4 CPU: Code: FX-9860G SD @ 29.5 MHz: 0.489 sec RE: N-Queens results on Casio calculators - nickapos - 08-21-2024 03:49 AM (08-20-2024 10:42 PM)xerxes Wrote: I've updated the list with the new C.BASIC test code from Hlib and removed the previous results.Please excuse my ignorance but how do you time the execution with such accuracy ? RE: N-Queens results on Casio calculators - toml_12953 - 08-21-2024 06:38 PM (08-21-2024 03:49 AM)nickapos Wrote:(08-20-2024 10:42 PM)xerxes Wrote: I've updated the list with the new C.BASIC test code from Hlib and removed the previous results.Please excuse my ignorance but how do you time the execution with such accuracy ? CBASIC has a real-time clock included. To initialize it, set Ticks to 0 at the beginning of your program, then when your program ends, print Ticks. The resolution is 1/128 sec. RE: N-Queens results on Casio calculators - xerxes - 08-21-2024 11:02 PM (08-21-2024 03:49 AM)nickapos Wrote: Please excuse my ignorance but how do you time the execution with such accuracy ? As toml_12953 stated, C.BASIC offers the Ticks command. For more accuracy I use an outer loop for fast and very fast devices and languages. RE: N-Queens results on Casio calculators - Hlib - 08-23-2024 08:59 AM I offer you a faster CASIO-BASIC(structured) program. It does not look as neat as MicroPython code, but it allows you to get an increase in speed in the range of 17 ... 28% for some CASIO models. This code is not suitable for CBASIC, as well as for calculators from the old generation (e.g. FX-7450G+/9700GE/9750G+). Code:
t=22.5_sec vs 29_sec, FX-9750GII (SH3, OS 2.0), +22% increase in speed. t=42_sec vs 58.7_sec, FX-9860GII-2 (SH4, OS 2.09), +28%, without USB. t=103_sec (1:43) vs 125_sec (2:05), AFX-2.0+, GRAPH-100+, +17%. I don`t use lists in the above models because with the list-type variables the results are not stable. The more lists are defined in these calculators, the lower the speed of operations with list items. A standard algorithm was used. S=876, result is Mat A=[[8][4][1][3][6][2][7][5]] RE: N-Queens results on Casio calculators - xerxes - 08-24-2024 02:41 PM Thank you for your offer and effort. Please allow me to leave the test code of these calculators unchanged, because that would mean that we have to do the same or similar changes of the algorithm for comparability on other machines too. The test algorithm is deliberately chosen to be very simple, to be executable on almost all programmable calculators in the same or as similar as possible way. I know, there are some exceptions in the list. (08-23-2024 08:59 AM)Hlib Wrote: I don`t use lists in the above models because with the list-type variables the results are not stable. The more lists are defined in these calculators, the lower the speed of operations with list items. This is the reason, why I've also used a matrix in the test code. RE: N-Queens results on Casio calculators - Hlib - 08-24-2024 06:18 PM @ Xerxes Quote:... Please allow me to leave the test code of these calculators unchanged, because that would mean that we have to do the same or similar changes of the algorithm for comparability on other machines too.You misunderstood me. When I said "is not suitable", it only meant the fact that structured code shows a lower speed in CBASIC and in FX-9750G+(CFX-9850GB+ etc.) than unstructured code. In fact, the new (and fastest) structured program fixes the compatibility issue that is present in the old benchmark for FX-2.0+, FX-9860G, FX-9860GII, FX-CG50. The old structured code does not run in FX-9750G+(CFX-9850GB+ etc.) and causes the message Syntax ERROR because nested structures While do not work in these models. Now the new program runs fine in FX-9750G+ (CFX-9850GB+ etc.) and does not cause an error message. Also, the above-corrected unstructured code is still executed on the models for which it was intended, and even the calculation time remains the same. The old code with kludge Deg or Rad looks a bit inelegant. RE: N-Queens results on Casio calculators - xerxes - 08-24-2024 09:25 PM (08-24-2024 06:18 PM)Hlib Wrote: You misunderstood me. Sorry for the misunderstanding. RE: N-Queens results on Casio calculators - CalcLoverHK - 08-25-2024 10:38 AM (08-21-2024 11:02 PM)xerxes Wrote: As toml_12953 stated, C.BASIC offers the Ticks command. For more accuracy I use an outer loop for fast and very fast devices and languages. C.Basic also has a setting called `Exec TimeDsp` that displays the total execution time at the end of a program. That being said, I noticed Hlib didn't use the latest version of C.Basic which includes the change in compiler (SHC➝GCC). With C.Basic v2.50-β1, the results are now: Code: FX-9860G Slim @ 29.5 MHz: 0.383 sec RE: N-Queens results on Casio calculators - xerxes - 08-26-2024 06:05 AM (08-25-2024 10:38 AM)CalcLoverHK Wrote: the results are now: Thank you for testing. Hlibs test code for C.BASIC is very well done. |