Author Topic: RaspberryBASIC.org Forum  (Read 44698 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 2989
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #60 on: December 06, 2019, 03:56:26 PM »
Another direction I'm looking at is using Nim and IUP on the RPi. I built an IUP distribution for the RPi for ScriptBasic that can be repurposed for the Nim binding.

I'm really bummed out how much memory SB uses for strings and arrays besides them being slow. On the bright side SB is the fastest way to get something done.

Offline John

  • Forum Support / SB Dev
  • Posts: 2989
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #61 on: December 06, 2019, 05:15:11 PM »
I made the commitment to learn Nim.

Nim in Action

Offline AIR

  • BASIC Developer
  • Posts: 781
Re: RaspberryBASIC.org Forum
« Reply #62 on: December 07, 2019, 07:49:05 AM »
Cool, the more tools in one's tool shed, the easier it becomes to create those holiday gifts.... :D

Offline John

  • Forum Support / SB Dev
  • Posts: 2989
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #63 on: December 07, 2019, 08:23:23 AM »
I need to gather all the extensions I use with SB so it feels like home.

Offline AIR

  • BASIC Developer
  • Posts: 781
Re: RaspberryBASIC.org Forum
« Reply #64 on: December 07, 2019, 10:00:48 AM »
Bacon, using open_memstream:

Code: Text
  1. ' BaCon - 1mil3.bac
  2.  
  3. OPTION PARSE FALSE
  4.  
  5. s$ = ""
  6. t$ = ""
  7.  
  8. DECLARE a[1000001] TYPE NUMBER
  9. DECLARE len TYPE uint
  10. DECLARE *stream TYPE FILE
  11.  
  12. stream = open_memstream(&t$,&len)
  13.  
  14. FOR x = 1 TO 1000000
  15.   s$ = s$ & CHR$(MOD((x - 1), 26) + 65)
  16.   a[x] = x
  17.   IF LEN(s$) = 26 THEN
  18.     fprintf(stream,s$)
  19.     s$ = ""
  20.   END IF
  21. NEXT
  22. CLOSE FILE stream
  23.  
  24. r$ = REVERSE$(t$)
  25. FREE t$
  26. PRINT "r LEN: ",len
  27. PRINT "Front: ",LEFT$(r$, 26)
  28. PRINT "Back:  ",RIGHT$(r$, 26)
  29. PRINT "UBVal: ",a[1000000]

riveraa@rpi:~/Projects/Bacon $ /usr/bin/time ./mil
r LEN: 999986
Front: ZYXWVUTSRQPONMLKJIHGFEDCBA
Back:  ZYXWVUTSRQPONMLKJIHGFEDCBA
UBVal: 1000000
0.94user 0.05system 0:01.00elapsed 99%CPU (0avgtext+0avgdata 8024maxresident)k
0inputs+0outputs (0major+2066minor)pagefaults 0swaps

Offline John

  • Forum Support / SB Dev
  • Posts: 2989
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #65 on: December 07, 2019, 10:04:28 AM »
I'll update post and chart.

Expect a HUG from Peter.  :)

Offline AIR

  • BASIC Developer
  • Posts: 781
Re: RaspberryBASIC.org Forum
« Reply #66 on: December 07, 2019, 10:06:48 AM »
Run it on your machine, there is a difference in the timing I'm getting vs yours on the other tests.  That's why I asked which OS you're running before.

Offline John

  • Forum Support / SB Dev
  • Posts: 2989
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #67 on: December 07, 2019, 10:12:56 AM »
Are my times better or worse than what you are seeing on you new RPI 4B?

Offline AIR

  • BASIC Developer
  • Posts: 781
Re: RaspberryBASIC.org Forum
« Reply #68 on: December 07, 2019, 11:34:55 AM »
Yours are better

Offline John

  • Forum Support / SB Dev
  • Posts: 2989
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #69 on: December 07, 2019, 12:05:53 PM »
Since the APT UPDATE/UPGRADE and installing Nautilus/ gEdit and the suprising switch to Raspbian LXDE desktop, it seem to run faster than when I started.

Based on the BaCon results, it looks like my RPi 4B runs twice as fast.
« Last Edit: December 07, 2019, 02:25:12 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2989
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #70 on: December 07, 2019, 02:00:12 PM »
It seems the PHP .= works like the ScriptBasic &=. Post and table updated.

« Last Edit: December 07, 2019, 02:24:49 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 781
Re: RaspberryBASIC.org Forum
« Reply #71 on: December 07, 2019, 02:50:51 PM »
Based on the BaCon results, it looks like my RPi 4B runs twice as fast.

Could be the OS; I'm running DietPi which is supposed to be an optimized Raspbian but I'm beginning to wonder....even overclocking had no impact (I have a case with a fan, overclocking to 1900Mhz the temp went up only 2 degrees F in stress test).

Offline John

  • Forum Support / SB Dev
  • Posts: 2989
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #72 on: December 07, 2019, 03:09:51 PM »
It looks like the two winners are for compiled and interpretative are Nim and PHP.

I'm surprise how much this challenge affected how I view the toolchain.
« Last Edit: December 07, 2019, 03:34:29 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 781
Re: RaspberryBASIC.org Forum
« Reply #73 on: December 07, 2019, 03:50:06 PM »
Well, turns out it was the OS.  I installed Raspbian-lite on a spare sd card, and now the timings match yours.  DietPi -> Kicked To The Curb.....

Offline John

  • Forum Support / SB Dev
  • Posts: 2989
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #74 on: December 07, 2019, 04:34:55 PM »
I have been tempted to experiment with other OS offerings but I don't want to add another layer when stuff stops working.