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

Offline jalih

  • Advocate
  • Posts: 109
Re: RaspberryBASIC.org Forum
« Reply #135 on: December 10, 2019, 12:03:13 AM »
Pascal was my first "REAL" language (via Delphi 6 on Windows a long time ago).
You seem to be using semicolons  more like C than Pascal... I personally have not programmed in Pascal after elementary school but have sometimes used Modula-2 or Component Pascal.

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: RaspberryBASIC.org Forum
« Reply #136 on: December 10, 2019, 04:15:22 AM »
I use swiftc to compile.

Right, which by default compiles with debugging enabled which of course will slow things down.

I did a test on my Mac, compiling using swiftc.  The first run with no optimization, the second with optimization:

[riveraa@mini ~/tmp/swift] $ time ./debug
r LEN:  999986
Front:  ZYXWVUTSRQPONMLKJIHGFEDCBA
Back:   ZYXWVUTSRQPONMLKJIHGFEDCBA
UBVal:  100000

real    0m0.977s
user    0m0.961s
sys    0m0.011s

[riveraa@mini ~/tmp/swift] $ time ./release
r LEN:  999986
Front:  ZYXWVUTSRQPONMLKJIHGFEDCBA
Back:   ZYXWVUTSRQPONMLKJIHGFEDCBA
UBVal:  100000

real    0m0.326s
user    0m0.313s
sys    0m0.009s


Optimized compile:  swiftc -O main.swift -o release

AIR.

Offline jalih

  • Advocate
  • Posts: 109
Re: RaspberryBASIC.org Forum
« Reply #137 on: December 10, 2019, 06:32:53 AM »
I timed following 8th code on ROCK64 (should be about the same as RPI4 speedwise):
Code: [Select]
1000000 constant LIMIT

a:new 0 a:push var, a
0 b:new true b:writable var, s
0 b:new true b:writable var, t


: iterate
  s @ "" 2 pick n:1- 26 n:mod 65 n:+ s:+ b:append
  b:len 26 n:< not if
    t @ swap b:append drop
    0 b:new true b:writable s !
  else
    drop
  then
  a:push ;

: app:main
  a @ ' iterate 1 LIMIT loop
  t @ b:rev >s s:len "r LEN: %d\n" s:strfmt .
  dup 26 s:lsub "Front: %s\n" s:strfmt .
  26 s:rsub "Back:  %s\n" s:strfmt .
  LIMIT a:@ nip "UBVal: %d\n" s:strfmt .
  bye ;

Result was:
Code: [Select]
root@DietPi:~/Downloads# time /opt/8th/bin/rpi64/8th r3.8th
r LEN: 999986
Front: ZYXWVUTSRQPONMLKJIHGFEDCBA
Back:  ZYXWVUTSRQPONMLKJIHGFEDCBA
UBVal: 1000000

real 0m2,270s
user 0m2,160s
sys 0m0,100s
Memory usage was:
Code: [Select]
{"fault":0,"isrss":0,"rss":66452,"load15":0.30000,"ixrss":0,"load1":0.56000,"idrss":0,"swap":0,"load5":0.47000}

So, it's quite a lot faster than 40 seconds you have on the chart...

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: RaspberryBASIC.org Forum
« Reply #138 on: December 10, 2019, 09:08:21 AM »
Nice, Jalih!

One thing I should point out:  I had installed DietPi on my Raspberry Pi 4 when I first got it, and my benchmarks were quite a bit slower than Raspbian installed on the same Pi, even when I overclocked it.

I didn't go too deep into determining why that was, in both cases I was running minimal installs instead of the full blown install, so it wasn't about additional resources being consumed by GUI processes since I don't use Linux like that (old school console/ssh access is all I need!  LOL).

AIR.




Offline jalih

  • Advocate
  • Posts: 109
Re: RaspberryBASIC.org Forum
« Reply #139 on: December 10, 2019, 09:42:57 AM »
One thing I should point out:  I had installed DietPi on my Raspberry Pi 4 when I first got it, and my benchmarks were quite a bit slower than Raspbian installed on the same Pi, even when I overclocked it.
I didn't test many distros, DietPi worked and was clean enough! Performance with 8th is actually a lot better in most tasks with ROCK64 than on my six core desktop PC running Windows! It seems Windows version of the 8th is the slowest version of all!     

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #140 on: December 10, 2019, 10:41:40 AM »
Jalif,

I need a binary for your latest submission if you are ready to release your code.

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #141 on: December 10, 2019, 11:51:10 AM »
AIR,
I used -O with your last submission. Swift generates a main even if you use the -o option. There was about a second improvement over non-optimized.

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #142 on: December 10, 2019, 11:55:21 AM »
I'm hoping a FreeBasic fan sees this and submits an optimized version.

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #143 on: December 10, 2019, 01:06:06 PM »
Can we move this thread to the RaspberryBASIC forum? It isn't a blog and I'm wasting a lot of time being a messenger. I approved AIR's membership so he is free to post there. I'm sadden that @ejolson, heater, hippy and others didn't bother to join us. I miss the relationship.

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: RaspberryBASIC.org Forum
« Reply #144 on: December 10, 2019, 01:35:06 PM »
Ever since you approved me, this is what I get when logging in:

Quote from: FAIL
  An Error Has Occurred!    Your session timed out while posting.  Please go back and try again.

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #145 on: December 10, 2019, 01:52:49 PM »
Use the toolbar login method and it should save your cookie.

This seems to be happening with all the sites I host. Sorry!

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: RaspberryBASIC.org Forum
« Reply #146 on: December 10, 2019, 06:06:59 PM »
John, what timing do you get with the following?

Code: Text
  1. // Swift 5.1.2 - 1mil3.swift
  2.  
  3. var s = ""
  4. var t = ""
  5. var a = [Int](repeating: 0, count: 1000001)
  6. var i = 0
  7.  
  8. for x in 1...1000000 {
  9.   let c = Character(UnicodeScalar(((x - 1) % 26)+65)!)
  10.   s.append(c)
  11.   i += 1
  12.   a[x] = x
  13.   if i == 26 {
  14.     t.append(String(s.reversed()))
  15.     s = ""
  16.     i = 0
  17.   }
  18. }
  19.  
  20. print("r LEN: ", t.count)
  21. print("Front:  \(t.prefix(26))")
  22. print("Back:   \(t.suffix(26))")
  23. print("UBVal: ", a[100000])
  24.  

AIR.

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #147 on: December 10, 2019, 06:19:18 PM »
No improvement.


pi@RPi4B:~/swift-dev/examples $ swiftc -O 1mil3-4.swift
pi@RPi4B:~/swift-dev/examples $ timex ./main
r LEN:  999986
Front:  ZYXWVUTSRQPONMLKJIHGFEDCBA
Back:   ZYXWVUTSRQPONMLKJIHGFEDCBA
UBVal:  100000
23.33user 0.05system 0:23.51elapsed 99%CPU (0avgtext+0avgdata 12024maxresident)k
6368inputs+0outputs (25major+1877minor)pagefaults 0swaps
pi@RPi4B:~/swift-dev/examples $



You can download my Swift 5.1.2 RPi build here.
https://raspberrybasic.org/download/swift-5.1.2_armv7.tgz
« Last Edit: December 10, 2019, 06:33:14 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: RaspberryBASIC.org Forum
« Reply #148 on: December 10, 2019, 08:30:03 PM »
The String object in Swift.org's RPI version of Swift is brain dead, on top of being slow.

I downloaded and installed the RPI deb from their site, tried a few things, but it reinforces the fact that I will never use Swift for any real code.  I'm about to uninstall it now.

AIR.

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RaspberryBASIC.org Forum
« Reply #149 on: December 10, 2019, 08:51:04 PM »
My 5.1.2 of Swift was built from the latest Apple sources and native on the RPi 4B. The latest binary I was able to find for the RPi was 5.1.1 which has the compare bug I found.

I didn't see any RPi distributions on the swift.org site. Where did you get the .deb from and what version was it?

« Last Edit: December 10, 2019, 10:35:58 PM by John »