Raspberry BASIC

Author Topic: Just REM  (Read 624 times)

admin

  • Administrator
  • *****
  • Posts: 5
    • View Profile
Just REM
« on: November 22, 2019, 11:17:36 PM »
This thread is focused on the startup and shutdown costs of a programming language. The challenge is to time an empty program with just a REMark as its code.

ScriptBasic

Code: Script BASIC
  1. UNDEF Remark
  2.  


pi@RPi4B:~/sbrt/examples $ /usr/bin/time scriba updown.sb
0.00user 0.00system 0:00.01elapsed 60%CPU (0avgtext+0avgdata 1692maxresident)k
0inputs+0outputs (0major+99minor)pagefaults 0swaps
pi@RPi4B:~/sbrt/examples $


« Last Edit: November 23, 2019, 02:57:52 AM by admin »

admin

  • Administrator
  • *****
  • Posts: 5
    • View Profile
Re: Just REM
« Reply #1 on: November 22, 2019, 11:19:29 PM »
BaCon

Code: Text
  1. REM
  2.  


pi@RPi4B:~/bacon-dev/examples $ bacon updown.bac
Converting 'updown.bac'... done, 2 lines were processed in 0.026 seconds.
Compiling 'updown.bac'... cc  -c updown.bac.c
cc -o updown updown.bac.o -lbacon -L. -lm 
Done, program 'updown' ready.
pi@RPi4B:~/bacon-dev/examples $ /usr/bin/time ./updown
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 1100maxresident)k
0inputs+0outputs (0major+75minor)pagefaults 0swaps
pi@RPi4B:~/bacon-dev/examples $


admin

  • Administrator
  • *****
  • Posts: 5
    • View Profile
Re: Just REM
« Reply #2 on: November 22, 2019, 11:21:24 PM »
FreeBasic

Code: FreeBasic
  1. REM
  2.  


pi@RPi4B:~/freebasic/examples $ fbc updown.bas
pi@RPi4B:~/freebasic/examples $ ls -l
total 28
-rwxr-xr-x 1 pi pi 23528 Nov 22 13:19 updown
-rw-r--r-- 1 pi pi     4 Nov 22 10:55 updown.bas
pi@RPi4B:~/freebasic/examples $ /usr/bin/time ./updown
0.00user 0.00system 0:00.01elapsed 58%CPU (0avgtext+0avgdata 2000maxresident)k
0inputs+0outputs (0major+118minor)pagefaults 0swaps
pi@RPi4B:~/freebasic/examples $


John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #3 on: November 22, 2019, 11:28:41 PM »
Python 3

Code: Python
  1. #
  2.  


pi@RPi4B:~/python-dev/examples $ /usr/bin/time python3 updown.py
0.07user 0.03system 0:00.10elapsed 98%CPU (0avgtext+0avgdata 7352maxresident)k
0inputs+0outputs (0major+733minor)pagefaults 0swaps
pi@RPi4B:~/python-dev/examples $

ScriptBasic Project Manager/Facilitator

John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #4 on: November 23, 2019, 12:21:09 AM »
Perl

Code: Perl
  1. #
  2.  


pi@RPi4B:~/perl-dev/examples $ /usr/bin/time perl updown.pl
0.00user 0.01system 0:00.01elapsed 91%CPU (0avgtext+0avgdata 3880maxresident)k
0inputs+0outputs (0major+182minor)pagefaults 0swaps
pi@RPi4B:~/perl-dev/examples $

ScriptBasic Project Manager/Facilitator

John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #5 on: November 23, 2019, 12:25:35 AM »
JavaScript

Code: Javascript
  1. //
  2.  


pi@RPi4B:~/javascript-dev/examples $ /usr/bin/time node updown.js
1.61user 0.14system 0:02.26elapsed 77%CPU (0avgtext+0avgdata 29144maxresident)k
38376inputs+0outputs (151major+5813minor)pagefaults 0swaps
pi@RPi4B:~/javascript-dev/examples $

« Last Edit: November 23, 2019, 12:27:43 AM by John Spikowski »
ScriptBasic Project Manager/Facilitator

John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #6 on: November 23, 2019, 12:34:21 AM »
bash

Code: Bash
  1. #
  2.  


pi@RPi4B:~/bash-dev/examples $ /usr/bin/time bash updown.sh
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 2524maxresident)k
0inputs+0outputs (0major+121minor)pagefaults 0swaps
pi@RPi4B:~/bash-dev/examples $

ScriptBasic Project Manager/Facilitator

John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #7 on: November 23, 2019, 01:08:33 AM »
C

Code: C
  1. int main (int argc, char** argv)
  2. {
  3. }
  4.  


pi@RPi4B:~/c-dev/examples $ gcc updown.c -o updown
pi@RPi4B:~/c-dev/examples $ ls -l
total 12
-rwxr-xr-x 1 pi pi 7912 Nov 22 17:05 updown
-rw-r--r-- 1 pi pi   37 Nov 22 17:05 updown.c
pi@RPi4B:~/c-dev/examples $ /usr/bin/time ./updown
0.00user 0.00system 0:00.00elapsed 75%CPU (0avgtext+0avgdata 824maxresident)k
0inputs+0outputs (0major+66minor)pagefaults 0swaps
pi@RPi4B:~/c-dev/examples $

« Last Edit: November 23, 2019, 01:12:04 AM by John Spikowski »
ScriptBasic Project Manager/Facilitator

John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #8 on: November 23, 2019, 02:27:51 AM »
Java

Code: Java
  1. class updown
  2.   {
  3.   public static void main(String args[])
  4.   {
  5.   }
  6.   }
  7.  


pi@RPi4B:~/java-dev/examples $ javac updown.java
pi@RPi4B:~/java-dev/examples $ /usr/bin/time java updown
0.18user 0.10system 0:00.26elapsed 107%CPU (0avgtext+0avgdata 19080maxresident)k
0inputs+88outputs (0major+1871minor)pagefaults 0swaps
pi@RPi4B:~/java-dev/examples $

« Last Edit: November 23, 2019, 02:31:16 AM by John Spikowski »
ScriptBasic Project Manager/Facilitator

John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #9 on: November 24, 2019, 06:04:25 AM »
PHP

Code: PHP
  1. <?php
  2. //
  3. ?>
  4.  


pi@RPi4B:~/php-dev/examples $ /usr/bin/time php updown.php
0.07user 0.03system 0:00.11elapsed 94%CPU (0avgtext+0avgdata 12792maxresident)k
0inputs+0outputs (0major+853minor)pagefaults 0swaps
pi@RPi4B:~/php-dev/examples $

ScriptBasic Project Manager/Facilitator

John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #10 on: November 24, 2019, 07:49:02 PM »
Here is a results table of the Do Nothing challenge.

ScriptBasic Project Manager/Facilitator

John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #11 on: November 24, 2019, 09:22:52 PM »
ScriptBasic

Code: Script BASIC
  1. ' ScriptBasic - 1mil.sb
  2.  
  3. accum = 0
  4. milvar = 1000000
  5.  
  6. FOR x = 1 TO 1000000
  7.   accum += 1
  8.   milvar -= 1
  9.   IF accum = milvar THEN PRINT "Middle\n"
  10. NEXT
  11. PRINT "Plus:  ",accum,"\n"
  12. PRINT "Minus: ",milvar,"\n"
  13.  


pi@RPi4B:~/sbrt/examples $ /usr/bin/time scriba 1mil.sb
Middle
Plus:  1000000
Minus: 0
2.18user 0.00system 0:02.21elapsed 99%CPU (0avgtext+0avgdata 1972maxresident)k
520inputs+0outputs (1major+108minor)pagefaults 0swaps
pi@RPi4B:~/sbrt/examples $
« Last Edit: November 26, 2019, 09:51:38 AM by John Spikowski »
ScriptBasic Project Manager/Facilitator

John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #12 on: November 24, 2019, 11:15:02 PM »
BaCon

Code: Text
  1. ' BaCon - 1mil.bac
  2.  
  3. accum = 0
  4. milvar = 1000000
  5.  
  6. FOR x = 1 TO 1000000
  7.   accum = accum + 1
  8.   milvar = milvar -1
  9.   IF accum = milvar THEN PRINT "Middle"
  10. NEXT
  11. PRINT "Plus:  ",accum
  12. PRINT "Minus: ",milvar
  13.  


pi@RPi4B:~/bacon-dev/examples $ bacon 1mil.bac
Converting '1mil.bac'... done, 13 lines were processed in 0.035 seconds.
Compiling '1mil.bac'... cc  -c 1mil.bac.c
cc -o 1mil 1mil.bac.o -lbacon -L. -lm 
Done, program '1mil' ready.
pi@RPi4B:~/bacon-dev/examples $ ls -l 1mil
-rwxr-xr-x 1 pi pi 49968 Nov 25 21:03 1mil
pi@RPi4B:~/bacon-dev/examples $ /usr/bin/time ./1mil
Middle
Plus:  1000000
Minus: 0
0.03user 0.00system 0:00.03elapsed 96%CPU (0avgtext+0avgdata 1536maxresident)k
0inputs+0outputs (0major+84minor)pagefaults 0swaps
pi@RPi4B:~/bacon-dev/examples $

« Last Edit: November 26, 2019, 07:43:01 AM by John Spikowski »
ScriptBasic Project Manager/Facilitator

John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #13 on: November 24, 2019, 11:40:30 PM »
FreeBasic

Code: FreeBasic
  1. ' FreeBasic - 1mil.bas
  2.  
  3. DIM accum AS Integer = 0
  4. DIM milvar AS Integer = 1000000
  5. DIM x AS Integer
  6.  
  7. FOR x = 1 TO 1000000
  8.   accum += 1
  9.   milvar -= 1
  10.   IF accum = milvar THEN PRINT "Middle"
  11. NEXT
  12. PRINT "Plus:  ",accum
  13. PRINT "Minus: ",milvar
  14.  


pi@RPi4B:~/freebasic-dev/examples $ fbc 1mil.bas
pi@RPi4B:~/freebasic-dev/examples $ ls -l 1mil
-rwxr-xr-x 1 pi pi 30092 Nov 25 21:13 1mil
pi@RPi4B:~/freebasic-dev/examples $ /usr/bin/time ./1mil
Middle
Plus:          1000000
Minus:         0
0.00user 0.01system 0:00.06elapsed 34%CPU (0avgtext+0avgdata 2072maxresident)k
0inputs+0outputs (0major+125minor)pagefaults 0swaps
pi@RPi4B:~/freebasic-dev/examples $

« Last Edit: November 26, 2019, 07:43:38 AM by John Spikowski »
ScriptBasic Project Manager/Facilitator

John Spikowski

  • BASIC Developer
  • **
  • Posts: 81
    • View Profile
    • ScriptBasic
Re: Just REM
« Reply #14 on: November 25, 2019, 12:37:07 AM »
C

Code: C
  1. // C - 1mil.c
  2.  
  3. #include <stdio.h>
  4.  
  5. int main (int argc, char** argv)
  6. {
  7. int accum = 0;
  8. int milvar = 1000000;
  9. int x;
  10.  
  11. for(x = 1; x <=  1000000; ++x)
  12.   {
  13.     ++ accum;
  14.     -- milvar;
  15.     if(accum == milvar) printf("Middle\n");
  16.   }
  17.   printf("Plus:  %d\n", accum);
  18.   printf("Minus: %d\n", milvar);
  19.   return 0;
  20. }
  21.  


pi@RPi4B:~/c-dev/examples $ gcc 1mil.c -o 1mil
pi@RPi4B:~/c-dev/examples $ ls -l 1mil
-rwxr-xr-x 1 pi pi 8016 Nov 25 21:24 1mil
pi@RPi4B:~/c-dev/examples $ /usr/bin/time ./1mil
Middle
Plus:  1000000
Minus: 0
0.02user 0.00system 0:00.02elapsed 100%CPU (0avgtext+0avgdata 1208maxresident)k
0inputs+0outputs (0major+73minor)pagefaults 0swaps
pi@RPi4B:~/c-dev/examples $

« Last Edit: November 26, 2019, 07:44:20 AM by John Spikowski »
ScriptBasic Project Manager/Facilitator