#!/bin/bash
echo `grep "model name" /proc/cpuinfo |cut -f 2 -d :` `grep "cpu MHz" /proc/cpuinfo |cut -f 2 -d :` Mhz ` grep "bogomips" /proc/cpuinfo |cut -f 2 -d :` bogomips
-echo "------------------------------------------------------------- Ruby"
-cat print.rb
-echo -n "Running..."
-time ./print.rb > /dev/null
+if [ "$1" == "all" ]
+then
+ echo "------------------------------------------------------------- Ruby"
+ cat print.rb
+ echo -n "Running..."
+ time ./print.rb > /dev/null
-echo "--------------------------------------------------- Python - range"
-cat print.py
-echo -n "Running..."
-time ./print.py > /dev/null
+ echo "--------------------------------------------------- Python - range"
+ cat print.py
+ echo -n "Running..."
+ time ./print.py > /dev/null
-echo "-------------------------------------------------- Python - xrange"
-cat xrange.py
-echo -n "Running..."
-time ./xrange.py > /dev/null
+ echo "-------------------------------------------------- Python - xrange"
+ cat xrange.py
+ echo -n "Running..."
+ time ./xrange.py > /dev/null
-echo "------------------------------------------------------------ PHP 5"
-cat echo.php
-echo -n "Running..."
-time ./echo.php > /dev/null
+ echo "------------------------------------------------------------ PHP 5"
+ cat echo.php
+ echo -n "Running..."
+ time ./echo.php > /dev/null
+fi
echo "-------------------------------------------------- C - gcc - write"
cat write.c
echo -n "Running..."
time ./cout > /dev/null
-#echo "----------------------------------------------- C<<1 - tcc - print"
-#cat cll1-print.c
-#echo -n "Compiling..."
-#time tcc -O2 cll1-print.c -o cll1-print
-#echo -n "Running..."
-#time ./cll1-print > /dev/null
-#
-#echo "------------------------------------------------- C - tcc - printf"
-#cat printf.c
-#echo -n "Compiling..."
-#time tcc -O2 printf.c -o printf
-#echo -n "Running..."
-#time ./printf > /dev/null
-#
-#echo "--------------------------------------------------- C - tcc - puts"
-#cat puts.c
-#echo -n "Compiling..."
-#time tcc -O2 puts.c -o puts
-#echo -n "Running..."
-#time ./puts > /dev/null
-#
-#echo "-------------------------------------------------- C - tcc - fputs"
-#cat fputs.c
-#echo -n "Compiling..."
-#time tcc -O2 fputs.c -o fputs
-#echo -n "Running..."
-#time ./fputs > /dev/null
-#
-#echo "------------------------------------------------- C - tcc - fwrite"
-#cat fwrite.c
-#echo -n "Compiling..."
-#time tcc -O2 fwrite.c -o fwrite
-#echo -n "Running..."
-#time ./fwrite > /dev/null
-#
-
-echo "-----------------------------------------------= C<<1 - gcc - echo"
+echo "----------------------------------------------- C<<1 - tcc - print"
+cat cll1-print.c
+echo -n "Compiling..."
+time tcc cll1-print.c -o cll1-print
+echo -n "Running..."
+time ./cll1-print > /dev/null
+
+echo "------------------------------------------------- C - tcc - printf"
+cat printf.c
+echo -n "Compiling..."
+time tcc printf.c -o printf
+echo -n "Running..."
+time ./printf > /dev/null
+
+echo "------------------------------------------------ C<<1 - tcc - echo"
+cat cll1-echo.c
+echo -n "Compiling..."
+time tcc cll1-echo.c -o cll1-echo
+echo -n "Running..."
+time ./puts > /dev/null
+
+echo "--------------------------------------------------- C - tcc - puts"
+cat puts.c
+echo -n "Compiling..."
+time tcc puts.c -o puts
+echo -n "Running..."
+time ./puts > /dev/null
+
+echo "------------------------------------------------- C - tcc - fwrite"
+cat fwrite.c
+echo -n "Compiling..."
+time tcc fwrite.c -o fwrite
+echo -n "Running..."
+time ./fwrite > /dev/null
+
+echo "-------------------------------------------------- C - tcc - fputs"
+cat fputs.c
+echo -n "Compiling..."
+time tcc fputs.c -o fputs
+echo -n "Running..."
+time ./fputs > /dev/null
+
+echo "------------------------------------------------ C<<1 - gcc - echo"
cat cll1-echo.c
echo -n "Compiling..."
time gcc -O2 cll1-echo.c -o cll1-echo
#!/bin/bash
echo `grep "model name" /proc/cpuinfo |cut -f 2 -d :` `grep "cpu MHz" /proc/cpuinfo |cut -f 2 -d :` Mhz ` grep "bogomips" /proc/cpuinfo |cut -f 2 -d :` bogomips
-echo "------------------------------------------------------------- Ruby"
-cat print2.rb
-echo -n "Running..."
-time ./print2.rb > /dev/null
-echo
+if [ "$1" == "all" ]
+then
+ echo "------------------------------------------------------------- Ruby"
+ cat print2.rb
+ echo -n "Running..."
+ time ./print2.rb > /dev/null
+ echo
-echo "--------------------------------------------------- Python - range"
-cat print2.py
-echo -n "Running..."
-time ./print2.py > /dev/null
-echo
+ echo "--------------------------------------------------- Python - range"
+ cat print2.py
+ echo -n "Running..."
+ time ./print2.py > /dev/null
+ echo
-echo "-------------------------------------------------- Python - xrange"
-cat xrange2.py
-echo -n "Running..."
-time ./xrange2.py > /dev/null
-echo
+ echo "-------------------------------------------------- Python - xrange"
+ cat xrange2.py
+ echo -n "Running..."
+ time ./xrange2.py > /dev/null
+ echo
-echo "------------------------------------------------------------ PHP 5"
-cat echo2.php
-echo -n "Running..."
-time -f "%E total, %U user, %S sys" ./echo2.php > /dev/null
-echo
+ echo "------------------------------------------------------------ PHP 5"
+ cat echo2.php
+ echo -n "Running..."
+ time ./echo2.php > /dev/null
+ echo
+fi
echo "-------------------------------------------------- C - gcc - write"
cat write2.c
echo "------------------------------------------------------------- Perl"
cat print2.pl
echo -n "Running..."
-time -f "%E total, %U user, %S sys" ./print2.pl > /dev/null
+time ./print2.pl > /dev/null
+echo
+
+echo "------------------------------------------------- C - tcc - printf"
+cat printf2.c
+echo -n "Compiling..."
+time tcc printf2.c -o printf2
+echo -n "Running..."
+time ./printf2 > /dev/null
+echo
+
+echo "------------------------------------------------- C - tcc - fwrite"
+cat fwrite2.c
+echo -n "Compiling..."
+time tcc fwrite2.c -o fwrite2
+echo -n "Running..."
+time ./fwrite2 > /dev/null
+echo
+
+echo "----------------------------------------------- C<<1 - tcc - print"
+cat cll1-print2.c
+echo -n "Compiling..."
+time tcc cll1-print2.c -o cll1-print2
+echo -n "Running..."
+time ./cll1-print2 > /dev/null
+echo
+
+echo "-------------------------------------------------- C - tcc - fputs"
+cat fputs2.c
+echo -n "Compiling..."
+time tcc fputs2.c -o fputs2
+echo -n "Running..."
+time ./fputs2 > /dev/null
echo
-#echo "------------------------------------------------- C - tcc - printf"
-#cat printf2.c
-#echo -n "Compiling..."
-#time tcc -O2 printf2.c -o printf2
-#echo -n "Running..."
-#time ./printf2 > /dev/null
-#echo
-#
-#echo "------------------------------------------------- C - tcc - fwrite"
-#cat fwrite2.c
-#echo -n "Compiling..."
-#time tcc -O2 fwrite2.c -o fwrite2
-#echo -n "Running..."
-#time ./fwrite2 > /dev/null
-#echo
-#
-#echo "----------------------------------------------- C<<1 - tcc - print"
-#cat cll1-print2.c
-#echo -n "Compiling..."
-#time tcc -O2 cll1-print2.c -o cll1-print2
-#echo -n "Running..."
-#time ./cll1-print2 > /dev/null
-#echo
-#
-#echo "-------------------------------------------------- C - tcc - fputs"
-#cat fputs2.c
-#echo -n "Compiling..."
-#time tcc -O2 fputs2.c -o fputs2
-#echo -n "Running..."
-#time ./fputs2 > /dev/null
-#echo
-#
echo "------------------------------------------------- C - gcc - printf"
cat printf2.c
echo -n "Compiling..."
-------------------------------------------------------------- Ruby
-#!/usr/bin/ruby
-
-10000000.times { print "stuff","\n" }
-
-Running...
-real 0m16.104s
-user 0m14.353s
-sys 0m1.412s
---------------------------------------------------- Python - range
-#!/usr/bin/python
-
-for i in range(1,10000000):
- print "stuff"
-
-Running...
-real 0m8.661s
-user 0m8.465s
-sys 0m0.168s
--------------------------------------------------- Python - xrange
-#!/usr/bin/python
-
-for i in xrange(1,10000000):
- print "stuff"
-
-Running...
-real 0m8.480s
-user 0m8.433s
-sys 0m0.016s
------------------------------------------------------------- PHP 5
-#!/usr/bin/php5 -q
-<?php
-for ( $i=0; $i<10000000; $i++ )
-{
- echo "stuff1\n";
-}
-?>
-Running...
-real 0m7.098s
-user 0m5.048s
-sys 0m2.024s
+AMD Athlon(tm) XP 1259.487 Mhz 2522.30 bogomips
-------------------------------------------------- C - gcc - write
#include <string.h>
return 0;
}
Compiling...
-real 0m0.061s
-user 0m0.048s
-sys 0m0.012s
+real 0m1.102s
+user 0m0.212s
+sys 0m0.044s
Running...
-real 0m2.906s
-user 0m0.848s
-sys 0m2.028s
+real 0m7.171s
+user 0m1.636s
+sys 0m5.536s
------------------------------------------------------------- Perl
#!/usr/bin/perl
}
Running...
-real 0m2.515s
-user 0m2.484s
-sys 0m0.008s
+real 0m5.808s
+user 0m5.600s
+sys 0m0.012s
----------------------------------------------- C<<1 - gcc - print
#include "cll1.h"
print("stuff");
}
Compiling...
-real 0m0.121s
-user 0m0.112s
-sys 0m0.008s
+real 0m0.567s
+user 0m0.352s
+sys 0m0.028s
Running...
-real 0m1.249s
-user 0m1.240s
-sys 0m0.004s
+real 0m2.122s
+user 0m2.112s
+sys 0m0.008s
---------------------------------------------- C - g++ - std::cout
#include <iostream>
return 0;
}
Compiling...
-real 0m0.362s
-user 0m0.320s
-sys 0m0.036s
+real 0m1.973s
+user 0m1.016s
+sys 0m0.100s
Running...
-real 0m0.990s
-user 0m0.984s
-sys 0m0.004s
------------------------------------------------= C<<1 - gcc - echo
+real 0m1.763s
+user 0m1.752s
+sys 0m0.012s
+----------------------------------------------- C<<1 - tcc - print
+#include "cll1.h"
+
+program
+{
+ repeat(10000000)
+ print("stuff");
+}
+Compiling...
+real 0m0.148s
+user 0m0.020s
+sys 0m0.008s
+Running...
+real 0m2.259s
+user 0m2.252s
+sys 0m0.008s
+------------------------------------------------- C - tcc - printf
+#include <stdio.h>
+
+#define RUNS 10000000UL
+int main (void)
+{
+ unsigned long i;
+ for (i=0;i<RUNS;i++)
+ {
+ printf("stuff\n");
+ }
+ return 0;
+}
+Compiling...
+real 0m0.032s
+user 0m0.004s
+sys 0m0.008s
+Running...
+real 0m1.924s
+user 0m1.924s
+sys 0m0.000s
+------------------------------------------------ C<<1 - tcc - echo
#include "cll1.h"
program
echo("stuff\n");
}
Compiling...
-real 0m0.117s
-user 0m0.100s
+real 0m0.021s
+user 0m0.016s
+sys 0m0.004s
+Running...
+real 0m1.109s
+user 0m1.104s
+sys 0m0.008s
+--------------------------------------------------- C - tcc - puts
+#include <stdio.h>
+
+#define RUNS 10000000UL
+int main (void)
+{
+ unsigned long i;
+ for (i=0;i<RUNS;i++)
+ {
+ puts("stuff");
+ }
+ return 0;
+}
+Compiling...
+real 0m0.014s
+user 0m0.008s
sys 0m0.008s
Running...
-real 0m0.757s
-user 0m0.744s
+real 0m1.152s
+user 0m1.144s
+sys 0m0.008s
+------------------------------------------------- C - tcc - fwrite
+#include <stdio.h>
+#include <string.h>
+
+#define RUNS 10000000UL
+int main (void)
+{
+ unsigned long i;
+ char *s1="stuff\n";
+ int l1=strlen(s1);
+
+ for (i=0;i<RUNS;i++)
+ {
+ fwrite(s1,l1,1,stdout);
+ }
+ return 0;
+}
+Compiling...
+real 0m0.013s
+user 0m0.012s
+sys 0m0.000s
+Running...
+real 0m1.048s
+user 0m1.032s
+sys 0m0.016s
+-------------------------------------------------- C - tcc - fputs
+#include <stdio.h>
+
+#define RUNS 10000000UL
+int main (void)
+{
+ unsigned long i;
+ for (i=0;i<RUNS;i++)
+ {
+ fputs("stuff\n",stdout);
+ }
+ return 0;
+}
+Compiling...
+real 0m0.012s
+user 0m0.012s
sys 0m0.000s
+Running...
+real 0m1.152s
+user 0m1.144s
+sys 0m0.008s
+------------------------------------------------ C<<1 - gcc - echo
+#include "cll1.h"
+
+program
+{
+ unsigned long i;
+ for_range(i,1,10000000)
+ echo("stuff\n");
+}
+Compiling...
+real 0m0.351s
+user 0m0.308s
+sys 0m0.040s
+Running...
+real 0m1.243s
+user 0m1.236s
+sys 0m0.008s
------------------------------------------------- C - gcc - printf
#include <stdio.h>
return 0;
}
Compiling...
-real 0m0.067s
-user 0m0.040s
-sys 0m0.024s
+real 0m0.196s
+user 0m0.164s
+sys 0m0.032s
Running...
-real 0m0.630s
-user 0m0.608s
-sys 0m0.012s
+real 0m1.106s
+user 0m1.104s
+sys 0m0.004s
--------------------------------------------------- C - gcc - puts
#include <stdio.h>
return 0;
}
Compiling...
-real 0m0.058s
-user 0m0.036s
-sys 0m0.024s
+real 0m0.197s
+user 0m0.172s
+sys 0m0.028s
Running...
-real 0m0.633s
-user 0m0.632s
-sys 0m0.000s
+real 0m1.105s
+user 0m1.084s
+sys 0m0.020s
------------------------------------------------- C - gcc - fwrite
#include <stdio.h>
#include <string.h>
return 0;
}
Compiling...
-real 0m0.137s
-user 0m0.060s
-sys 0m0.008s
+real 0m0.216s
+user 0m0.188s
+sys 0m0.028s
Running...
-real 0m0.555s
-user 0m0.548s
-sys 0m0.004s
+real 0m1.027s
+user 0m1.012s
+sys 0m0.012s
-------------------------------------------------- C - gcc - fputs
#include <stdio.h>
return 0;
}
Compiling...
-real 0m0.058s
-user 0m0.040s
-sys 0m0.016s
+real 0m0.199s
+user 0m0.152s
+sys 0m0.048s
Running...
-real 0m0.551s
-user 0m0.548s
-sys 0m0.004s
+real 0m1.023s
+user 0m1.008s
+sys 0m0.016s
-------------------------------------------------------------- Ruby
-#!/usr/bin/ruby
-
-10000000.times { print "stuff1"," ","stuff2","\n" }
-
-Running...
-real 0m24.569s
-user 0m23.113s
-sys 0m1.420s
-
---------------------------------------------------- Python - range
-#!/usr/bin/python
-
-for i in range(1,10000000):
- print "stuff1","stuff2"
-
-Running...
-real 0m13.571s
-user 0m13.369s
-sys 0m0.200s
-
--------------------------------------------------- Python - xrange
-#!/usr/bin/python
-
-for i in xrange(1,10000000):
- print "stuff1","stuff2"
-
-Running...
-real 0m13.118s
-user 0m13.105s
-sys 0m0.012s
-
------------------------------------------------------------- PHP 5
-#!/usr/bin/php5 -q
-<?php
-for ( $i=0; $i<10000000; $i++ )
-{
- echo "stuff1"." "."stuff2"."\n";
-}
-?>
-Running..../test-performance2.sh: line 24: -f: command not found
-
-real 0m0.001s
-user 0m0.000s
-sys 0m0.000s
-
+AMD Athlon(tm) XP 1259.487 Mhz 2522.30 bogomips
-------------------------------------------------- C - gcc - write
#include <string.h>
return 0;
}
Compiling...
-real 0m0.063s
-user 0m0.044s
-sys 0m0.016s
+real 0m0.205s
+user 0m0.172s
+sys 0m0.032s
Running...
-real 0m11.514s
-user 0m3.572s
-sys 0m7.928s
+real 0m28.001s
+user 0m6.400s
+sys 0m21.597s
---------------------------------------------- C - g++ - std::cout
#include <iostream>
return 0;
}
Compiling...
-real 0m0.367s
-user 0m0.336s
-sys 0m0.024s
+real 0m1.087s
+user 0m0.988s
+sys 0m0.100s
Running...
-real 0m8.012s
-user 0m6.092s
-sys 0m1.812s
+real 0m15.557s
+user 0m10.461s
+sys 0m5.096s
------------------------------------------------------------- Perl
#!/usr/bin/perl
{
print ("stuff1"," ","stuff2","\n");
}
-Running..../test-performance2.sh: line 46: -f: command not found
+Running...
+real 0m10.660s
+user 0m10.361s
+sys 0m0.028s
+
+------------------------------------------------- C - tcc - printf
+#include <stdio.h>
-real 0m0.001s
+#define RUNS 10000000UL
+int main (void)
+{
+ unsigned long i;
+ for (i=0;i<RUNS;i++)
+ {
+ printf("%s %s\n","stuff2","stuff2");
+ }
+ return 0;
+}
+Compiling...
+real 0m0.013s
user 0m0.000s
+sys 0m0.012s
+Running...
+real 0m5.387s
+user 0m5.316s
+sys 0m0.012s
+
+------------------------------------------------- C - tcc - fwrite
+#include <stdio.h>
+#include <string.h>
+
+#define RUNS 10000000UL
+int main (void)
+{
+ unsigned long i;
+ char *s1="stuff1";
+ char *s2="stuff2";
+ int l1=strlen(s1);
+ int l2=strlen(s2);
+
+ for (i=0;i<RUNS;i++)
+ {
+ fwrite(s1,l1,1,stdout);
+ fwrite(" ",1,1,stdout);
+ fwrite(s2,l2,1,stdout);
+ fwrite("\n",1,1,stdout);
+ }
+ return 0;
+}
+Compiling...
+real 0m0.015s
+user 0m0.008s
+sys 0m0.008s
+Running...
+real 0m3.751s
+user 0m3.708s
+sys 0m0.012s
+
+----------------------------------------------- C<<1 - tcc - print
+#include "cll1.h"
+
+program
+{
+ repeat(10000000)
+ print("stuff1","stuff2");
+}
+Compiling...
+real 0m0.022s
+user 0m0.020s
+sys 0m0.000s
+Running...
+real 0m4.780s
+user 0m4.716s
+sys 0m0.032s
+
+-------------------------------------------------- C - tcc - fputs
+#include <stdio.h>
+
+#define RUNS 10000000UL
+int main (void)
+{
+ unsigned long i;
+ for (i=0;i<RUNS;i++) {
+ fputs("stuff1",stdout);
+ fputs(" ",stdout);
+ fputs("stuff2",stdout);
+ fputs("\n",stdout);
+ }
+ return 0;
+}
+Compiling...
+real 0m0.012s
+user 0m0.008s
sys 0m0.004s
+Running...
+real 0m4.614s
+user 0m4.596s
+sys 0m0.020s
------------------------------------------------- C - gcc - printf
#include <stdio.h>
return 0;
}
Compiling...
-real 0m0.098s
-user 0m0.080s
-sys 0m0.016s
+real 0m0.199s
+user 0m0.164s
+sys 0m0.036s
Running...
-real 0m2.818s
-user 0m2.820s
-sys 0m0.000s
+real 0m5.027s
+user 0m4.996s
+sys 0m0.032s
------------------------------------------------- C - gcc - fwrite
#include <stdio.h>
return 0;
}
Compiling...
-real 0m0.070s
-user 0m0.052s
+real 0m0.221s
+user 0m0.204s
sys 0m0.016s
Running...
-real 0m2.665s
-user 0m2.624s
-sys 0m0.012s
+real 0m3.770s
+user 0m3.664s
+sys 0m0.028s
----------------------------------------------- C<<1 - gcc - print
#include "cll1.h"
print("stuff1","stuff2");
}
Compiling...
-real 0m0.121s
-user 0m0.100s
-sys 0m0.016s
+real 0m0.364s
+user 0m0.352s
+sys 0m0.012s
Running...
-real 0m2.510s
-user 0m2.508s
-sys 0m0.004s
+real 0m4.519s
+user 0m4.504s
+sys 0m0.016s
-------------------------------------------------- C - gcc - fputs
#include <stdio.h>
return 0;
}
Compiling...
-real 0m0.060s
-user 0m0.052s
-sys 0m0.008s
+real 0m0.205s
+user 0m0.180s
+sys 0m0.024s
Running...
-real 0m1.567s
-user 0m1.560s
-sys 0m0.008s
-
+real 0m2.642s
+user 0m2.612s
+sys 0m0.032s