Really really fast BASIC handheld

01092019, 04:03 PM
Post: #1




Really really fast BASIC handheld
Hallo,
I tried something from which I have never expacted to be much much faster as the HP Prime. And it's using interpreted BASIC on a small handheld: Tada: The New Nintendo 2DS XL (release 2017) with SmileBasic (you can get this like games from the Nintendo Store). It's fast! Very Fast! Example: The Summation Benchmark: CLS M=MAINCNT 'Frames since start of Basic with 60 per second A=0 FOR X=1 TO 100000 A=A+POW(EXP(SIN(ATAN(RAD(X)))),1/3) ' pow is used because 3. Root doesn't exist ' RAD is used to change degree to radian because all trig function use radian NEXT PRINT A PRINT ROUND(10/6*(MAINCNTM))/100; " sec" 'rounded of 2 decimal digits The result: 0.55 secunds, Result 139536.56649434 compare this with the other handhelds like: max = 100000 ~ 7.7s  HWPrime G2 , sum function http://www.hpmuseum.org/forum/thread975...#pid102818 ~ 9s  TI Nspire CX CAS, hardware version N0118AB (2018), OS 4.5.0.1180 (2017): C with Ndless. Post #147 ... This is 14 times faster then the fastest calculator the HP Prime! And with max=1000000 (1 million) you get: 5.53 seconds with 1395587.74219818 And the precision of the calculation is not bad. It's an interpreted program language, which support all feature of the 3DS (like backgrund music, 2 color display with 3d, sprites, aninimation, WIFI, gyroscope, mic, touch screen controls etc.) and all important mathematical functions you need for science. And the RAM for the BASIC is big: more than 8 Megabyte. I have programmed the ULAM spiral (https://en.wikipedia.org/wiki/Ulam_spiral) with changing the starting center and 240 by 240 numbers. The calculation of the first 110000 numbers if they are primes don't need not more than 1 second. And the print of the spiral is done several time per second. If you knew any handheld (NOT PC) with a buildin language and editor let me know please! (No, IDE on an external PC is something like cheating for me. I think that's reason to use a handheld or I can use a PC directly). I hope this will show an alternative way to use existing devices! Bye Bernd 

01102019, 01:10 AM
(This post was last modified: 01102019 01:13 AM by Dan.)
Post: #2




RE: Really really fast BASIC handheld
I was about to ask if you can do plots on it, but after reading again I see you already have. Do you know what processor it uses?


01102019, 08:16 AM
Post: #3




RE: Really really fast BASIC handheld
(01092019 04:03 PM)berndpr Wrote: A=A+POW(EXP(SIN(ATAN(RAD(X)))),1/3) You shouldn't need to use RAD(X). X isn't an angle, so converting it from degrees to radians doesn't make sense. — Ian Abbott 

01102019, 08:31 AM
Post: #4




RE: Really really fast BASIC handheld
(01102019 01:10 AM)Dan Wrote: I was about to ask if you can do plots on it, but after reading again I see you already have. Do you know what processor it uses? But you must write a little program to plot your function. As far as I know a quad core ARM (from german wikipedia). I have made a Mandelbrot program like in numworks (https://workshop.numworks.com/python/num...mandelbrot) and compared it with the benchmark test of numworks and HP prime at youtube. 3DS needs 5 seconds with 20 iteration, numworks and prime needs minutes with 10 iteration. I think I have found my portable number cruncher for the next year. Bernd 

01102019, 08:37 AM
Post: #5




RE: Really really fast BASIC handheld
(01102019 08:16 AM)ijabbott Wrote:(01092019 04:03 PM)berndpr Wrote: A=A+POW(EXP(SIN(ATAN(RAD(X)))),1/3) Yes, I know. But as far as I understand the benchmark is using degree as input for the sin function. For comparing the results I thought I use the same input, even this is mathematical not necessary. Bernd 

01102019, 08:54 AM
(This post was last modified: 01102019 08:55 AM by ijabbott.)
Post: #6




RE: Really really fast BASIC handheld
(01102019 08:37 AM)berndpr Wrote:(01102019 08:16 AM)ijabbott Wrote: You shouldn't need to use RAD(X). X isn't an angle, so converting it from degrees to radians doesn't make sense. But X isn't in degrees or radians. It is the tangent of an angle. SIN(ATAN(X)) is the sine of the same angle and should give the same result (subject to minor rounding errors) on a calculator set to degrees or radians. By replacing X with RAD(X) you are passing the wrong values to the SIN(ATAN(x)) function. I'm not sure if the benchmark specifies degrees or radians mode to be used. There might be a slight difference in speed between the two for a particular machine, but the final resulting value should be more or less the same (subject to accumulated rounding errors). — Ian Abbott 

01112019, 06:27 AM
Post: #7




RE: Really really fast BASIC handheld
(01102019 08:54 AM)ijabbott Wrote:(01102019 08:37 AM)berndpr Wrote: Yes, I know. But as far as I understand the benchmark is using degree as input for the sin function. For comparing the results I thought I use the same input, even this is mathematical not necessary. OK, you are right. I have delete the RAD function: I got this results for 100000: Time 0.53 and 139560.97614105. So it's faster and the result is different. I hope this satisfy you now. Bernd 

01112019, 06:40 AM
(This post was last modified: 01112019 06:41 AM by Dan.)
Post: #8




RE: Really really fast BASIC handheld
(01102019 08:31 AM)berndpr Wrote: As far as I know a quad core ARM (from german wikipedia). I haven't been following the HP Prime, but I would guess the quad core processor is the reason why  the mathematical algorithms are probably similar. Sounds like a cool device, have fun! 

01112019, 07:11 AM
Post: #9




RE: Really really fast BASIC handheld
Hallo!
I have tried the NQueen Benchmarks. The unstructured BASIC version with labels, because SmileBasic has no line numbers. With OPTION DEFINT and a outer loop of 1000 I got this this time: 11.97 seconds, so less than 12 msecs for one run. No bad for an interpreted language. And I tried the structured version in BASIC with same conditions: OPTION DEFINT and outer loop of 1000 12.52 sec, so 12.5 msec for one run. Funny, the goto version is faster than the version with repeat, while and for. And I have tried the Savage Benchmarks. I have found 2 versions in this forum (why using 2 definitions?): FOR I = 1 TO 2499 A=TAN(ATAN(EXP(LOG(SQR(POW(A+1,2)))))) NEXT Time with a outer loop of 1000: 14.75 sec, so 14.75 msec per run. 2. Version: FOR I = 1 TO 2499 A=TAN(ATAN(EXP(LOG(SQR(A*A)))))+1 NEXT Time with a outer loop of 1000: 13.42 sec, so 13.42 msec per run. The result of A is 2500 in both cases. And I have tried to find the error with 2500A. But it shows than 0. I have found the first quirk of this BASIC. It show the floating point number with zeros and not a EE or so. If you calculate 69! the answer is several lines along with the many trailing zeros. Strange! But the precision inside is good. I have calculate PI or e with several thousand digits. And there is no problem as far as I know. I using the 3DS for fast grafic output, so the big or very small number output is not a problem. If you are interested in the codes, I can post it here. Bernd 

01112019, 10:34 AM
Post: #10




RE: Really really fast BASIC handheld
(01112019 06:27 AM)berndpr Wrote: I have delete the RAD function: Faster and more accurate! — Ian Abbott 

01112019, 12:05 PM
(This post was last modified: 01112019 12:06 PM by Maximilian Hohmann.)
Post: #11




RE: Really really fast BASIC handheld
Hello!
Interesting. I guess that BASIC interpreter was developed to encourage the (mostly yonug I suppose) users of these Nintendo toys to make their own games  just as in the old days of the C64. Is it possible to connect a keyboard of some kind, via Bloetooth maybe, to the device? Because if it is anything like the Nintendos our son used to play with when he was younger, then one would need to "type" in the programs using a ridiculously small stylus on a very low resolution even more ridiculously small touch display... All the precious lifetime gained by the fast program execution speed will be lost by fiddling around whilst entering the commands! Regards May 

01112019, 01:34 PM
Post: #12




RE: Really really fast BASIC handheld
(01112019 07:11 AM)berndpr Wrote: The unstructured BASIC version with labels, because SmileBasic has no line numbers. Thank you for testing SmileBasic, that turns the Nintendo into a very powerful pocket computer like device. Thats pretty fast for a bytecode interpreter. The german wiki mentions a CPU clock switch in the home menue, but I guess it's running at 804 MHz already. (01112019 07:11 AM)berndpr Wrote: And I tried the structured version in BASIC with same conditions: I've made the same observation on many languages. (01112019 07:11 AM)berndpr Wrote: If you are interested in the codes, I can post it here. Yes please. I guess you have tested ver.3.6.0? Calculator Benchmark 

01112019, 04:20 PM
Post: #13




RE: Really really fast BASIC handheld
I'd be curious to know if Smilebasic runs the CPU at 804 MHz on the New 3DS/2DS. If not, then it's possible to use custom firmware to force the CPU up to 804 MHz from the default 264 MHz, as well as enable the L2 cache that was added to the "New" models. It makes a noticeable difference in some games; Code of Princess gets a massive frame rate boost. (They also went from 2 cores to 4 cores, I believe, but depending on how many threads Smilebasic runs, that might not make any difference.)


01112019, 04:21 PM
Post: #14




RE: Really really fast BASIC handheld
(01092019 04:03 PM)berndpr Wrote: <...snip...> Hi Bernd, I looked up that machine and I see a handheld gaming device. Can you post a picture of what it looks like when running SmileBasic? Does the screen turn into a keyboard? How do you enter your program? Thanks! smp 

01112019, 10:48 PM
Post: #15




RE: Really really fast BASIC handheld
Systems Analyst 48G+/58C/85B/PC1500A TH78A/DooGee S9 Focal & All Basic´s 

01122019, 08:03 AM
(This post was last modified: 01122019 08:05 AM by Stevetuc.)
Post: #16




RE: Really really fast BASIC handheld
(01092019 04:03 PM)berndpr Wrote: Hallo, And if you want really fast: There's already a C library for writing user mode arm11 code for the 3DS/2DS https://github.com/smealum/ctrulib 3DS homebrew coming soon? https://twitter.com/smealum/status/523002877514493952 

01122019, 10:21 AM
(This post was last modified: 01122019 10:26 PM by StephenG1CMZ.)
Post: #17




RE: Really really fast BASIC handheld
I thought Smilebasic was builtin, like on old DOS PCs.
But this website says "how to purchase" http://smilebasic.com/en/ From a very quick read, it seems it can be purchased and downloaded straight onto Nintendo  no idea if Nintendo require a credit card or whether a gift card can be used. (Update A more thorough perusal of the eShop gives no clues as to whether kids, or those cautious about credit card numbers, can buy it... But, UK supermarkets do sell Nintendo gift cards). The instruction manual says to start SmileBasic by select Start Basic from a menu  I didn't see any mention of buying a game cartridge, either for basic or your programs. But I did glimpse a worrying mention of 4 slots  does that mean you can only have 3 programs? (One of the 4 slots is used for animation). The spec for a DS in the shop makes no mention of it being able to compile or run Basic...just think how many sales they might have lost. Stephen Lewkowicz (G1CMZ) 

01122019, 02:41 PM
Post: #18




RE: Really really fast BASIC handheld
nice find! question: could you send / save programs to and from the pc?
Because for me having an external repository that survives is a must have . Furthermore I believe the extended math library of high end calculators is missing. Rebuilding it should be no joke. Unless smile basic is like the basic of the hp 71b, glorious. Wikis are great, Contribute :) 

01122019, 04:56 PM
Post: #19




RE: Really really fast BASIC handheld
Skimming through the online manual for more information, a "slot" seems to correspond to a project, which can hold multiple text and data files. Basic programs are saved as text files. It would seem you are not limited to just four programs.
A slot or project can be saved to or loaded from an SD card, so you can transfer to or from a PC. They specify the Unicode character set used by Basic and provide a downloadable font set, so I assume a suitable editor could work with a Basic program file. Hummm, 3D Free42 anyone? ~Mark Remember kids, "In a democracy, you get the government you deserve." 

01122019, 09:41 PM
(This post was last modified: 01122019 09:46 PM by StephenG1CMZ.)
Post: #20




RE: Really really fast BASIC handheld
Actually, on one of the sites it was suggested that the SD cards are encrypted... Someone even wrote a cassette modem type program to transfer files as audio as a workaround. So editing on a PC might not be straightforward.
https://smilebasicsource.com/forum?ftid=7. Stephen Lewkowicz (G1CMZ) 

« Next Oldest  Next Newest »

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