Raspberry BASIC

Raspberry BASIC => Programming Challenges => Topic started by: admin on November 22, 2019, 11:17:36 PM

Title: Just REM
Post by: admin 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 $


Title: Re: Just REM
Post by: admin 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 $

Title: Re: Just REM
Post by: admin 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 $

Title: Re: Just REM
Post by: John Spikowski 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 $

Title: Re: Just REM
Post by: John Spikowski 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 $

Title: Re: Just REM
Post by: John Spikowski 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 $

Title: Re: Just REM
Post by: John Spikowski 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 $

Title: Re: Just REM
Post by: John Spikowski 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 $

Title: Re: Just REM
Post by: John Spikowski 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 $

Title: Re: Just REM
Post by: John Spikowski 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 $

Title: Re: Just REM
Post by: John Spikowski on November 24, 2019, 07:49:02 PM
Here is a results table of the Do Nothing challenge.