performance test - write, fwrite and cll1 single arugment echo added
authorxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Tue, 29 Jan 2008 17:11:54 +0000 (17:11 +0000)
committerxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Tue, 29 Jan 2008 17:11:54 +0000 (17:11 +0000)
git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@48 4bb87942-c103-4e5a-b51c-0ebff58f8515

16 files changed:
cll1.h
demos/advanced-hello-world.c
demos/performance/cll1-echo.c [new file with mode: 0644]
demos/performance/cout.cpp
demos/performance/fputs.c
demos/performance/print.rb
demos/performance/print2.rb
demos/performance/printf.c
demos/performance/printf2.c
demos/performance/puts.c
demos/performance/test-performance.sh
demos/performance/test-performance2.sh
demos/performance/test-results
demos/performance/test-results2
demos/performance/write.c
demos/performance/write2.c

diff --git a/cll1.h b/cll1.h
index 09195a531e9bd508a7997663847f090167245746..0a4b0eaa28eddc29f674fb3435e9d2200bee3d71 100644 (file)
--- a/cll1.h
+++ b/cll1.h
  '----------------------------------------------------------------------- */
 #define push(NODE,HEAD) ( NODE ? ((NODE->__next=HEAD),(HEAD=NODE)) : NULL )
 #define pop(NODE,HEAD) ( HEAD ? ((NODE=HEAD->__next),free(HEAD),(HEAD=NODE)) : (NODE=NULL) )
-#define append(NODE,HEAD) { void *N=NODE; /**/ NODE->__next=NULL; for_search(NODE,HEAD,!NODE->__next) { NODE->__next=N; break; } }
-#define remove(NODE,HEAD,EXPR) { void **_D=NULL; /**/ for_search(NODE,HEAD,EXPR) { if(_D)*_D=NODE->__next; else HEAD=NODE->__next; free(NODE); } else _D=(void *)&(NODE->__next); }
+#define append(NODE,HEAD) { void *N=NODE; /* <-' */ NODE->__next=NULL; for_search(NODE,HEAD,!NODE->__next) { NODE->__next=N; break; } }
+#define remove(NODE,HEAD,EXPR) { void **_D=NULL; /* <-' */ for_search(NODE,HEAD,EXPR) { if(_D)*_D=NODE->__next; else HEAD=NODE->__next; free(NODE); } else _D=(void *)&(NODE->__next); }
 #define drop(NODE,HEAD) for( NODE=HEAD; NODE || (HEAD=NULL); HEAD=NODE, NODE=NODE->__next, free(HEAD) )
 //to do: seek
 //to do: store
 #define desc_sort_by(K1,K2) (strcasecmp(K1, K2)<0)
 #define ascii_by(K1,K2) (strcmp(K1, K2)>0)
 #define desc_ascii_by(K1,K2) (strcmp(K1, K2)<0)
-#define insert(NODE,HEAD,EXP,K) { if(HEAD) { void **_L=NULL, *H=HEAD; /**/ for_search(HEAD,H,EXP(HEAD->K,NODE->K)) { if(_L) {*_L=NODE; NODE->__next=HEAD; } else push(NODE,H); break; } else _L=(void *)&(HEAD->__next); if(!HEAD)*_L=NODE; HEAD=H; } else if (NODE) { push(NODE,HEAD); HEAD->__next=NULL; } }
-#define sort(NODE,HEAD,EXP,K) { void *_NEXT; /**/ NODE=HEAD; HEAD=NULL; do { _NEXT=NODE->__next; NODE->__next=NULL; insert(NODE,HEAD,EXP,K); NODE=_NEXT; } while(_NEXT); }
+#define insert(NODE,HEAD,EXP,K) { if(HEAD) { void **_L=NULL, *H=HEAD; /* <-' */ for_search(HEAD,H,EXP(HEAD->K,NODE->K)) { if(_L) {*_L=NODE; NODE->__next=HEAD; } else push(NODE,H); break; } else _L=(void *)&(HEAD->__next); if(!HEAD)*_L=NODE; HEAD=H; } else if (NODE) { push(NODE,HEAD); HEAD->__next=NULL; } }
+#define sort(NODE,HEAD,EXP,K) { void *_NEXT; /* <-' */ NODE=HEAD; HEAD=NULL; do { _NEXT=NODE->__next; NODE->__next=NULL; insert(NODE,HEAD,EXP,K); NODE=_NEXT; } while(_NEXT); }
 /* .----------------------------------------------------------------------.
   /  7. C<<1 builtin iterators and conditionals, updated 2008-01-26 xCh.
  '----------------------------------------------------------------------- */
 #define construct_interface(MTYPE,...) _construct_##_##MTYPE##_##_ARG1(__VA_ARGS__)((void *)__get_##_##MTYPE##_##__VA_ARGS__)
 #define get_object(TYPE,...) (struct TYPE *)_cll1_allocate_object(sizeof(struct TYPE), __VA_ARGS__)
 #define construct_object(TYPE,...)
-//#define _(OBJECT,...) (_ASSERT(OBJECT),/**/(*(OBJECT->interface->_ARG1(__VA_ARGS__,)))/**/(OBJECT,OBJECT->interface->__VA_ARGS__)/**/)
+//#define _(OBJECT,...) (  _ASSERT(OBJECT), (*( OBJECT->interface->_ARG1(__VA_ARGS__,) )) ( OBJECT,OBJECT->interface->__VA_ARGS__ )  )
+//#define __(OBJECT,...) (  _ASSERT(OBJECT), (*( __cll1_seekmethod(OBJECT->interface,_ARG1(__VA_ARGS__,)) )) ( OBJECT,OBJECT->interface->__VA_ARGS__ )  )
 /* .----------------------------------------------------------------------.
   /  9. implementation of C<<1 library functions, updated 2008-01-26 xCh.
  '----------------------------------------------------------------------- */
 #define _MALLOC void *_cll1_malloc(size_t size,...) { /*temporary solution*/ return malloc(size); }
-#define _CLL1_FPRINT(IOSTREAM,LASTARG) { int p2=0;char *ofs=coalesce(OFS,"\0");va_list ap; /**/ for(va_start(ap,s);s!=LASTARG;s=va_arg(ap,char *)) { if(p2 && *ofs) fputs(ofs,IOSTREAM); else p2=1; fputs(coalesce(s,NIL),IOSTREAM); } va_end(ap); if(EOL && *EOL) fputs(EOL,IOSTREAM); }
+#define _CLL1_FPRINT(IOSTREAM,LASTARG) { int ofs=0; va_list ap; /* <-' */ for(va_start(ap,s);s!=LASTARG;s=va_arg(ap,char *)) { if(ofs)fputs(OFS,IOSTREAM);else ofs=1;/**/fputs(coalesce(s,NIL),IOSTREAM); } va_end(ap); fputs(EOL,IOSTREAM); }
 #define _PRINT void _cll1_print(char *s,...) _CLL1_FPRINT(stdout,(void *)&_cll1_print)
 #define _FPRINT void _cll1_fprint(FILE *f,char *s,...) _CLL1_FPRINT(f,(void *)&_cll1_fprint)
-#define _CLL1_FECHO(IOSTREAM,LASTARG) { va_list ap; /**/ for(va_start(ap,s);s!=LASTARG;s=va_arg(ap,char *)) fputs(coalesce(s,NIL),IOSTREAM); va_end(ap); }
+#define _CLL1_FECHO(IOSTREAM,LASTARG) { va_list ap; /* <-' */ for(va_start(ap,s);s!=LASTARG;s=va_arg(ap,char *)) fputs(coalesce(s,NIL),IOSTREAM); va_end(ap); }
 #define _ECHO void _cll1_echo(char *s,...) _CLL1_FECHO(stdout,(void *)&_cll1_echo)
 #define _FECHO void _cll1_fecho(FILE *f,char *s,...) _CLL1_FECHO(f,(void *)&_cll1_fecho)
-#define _IT_INTS int _cll1_it_ints(int i, int n, ...) { int j=0;va_list ap; /**/ va_start(ap,n); while(n>=0 && j++<i) n=va_arg(ap,int); return n; }
-#define _IT_STRS char *_cll1_it_strs(int i, char *s, ...) { int j=0;va_list ap; /**/ va_start(ap,s); while(s!=(void *)&_cll1_it_strs && j++<i) s=va_arg(ap,char *); return s; }
+#define _IT_INTS int _cll1_it_ints(int i, int n, ...) { int j=0;va_list ap; /* <-' */ va_start(ap,n); while(n>=0 && j++<i) n=va_arg(ap,int); return n; }
+#define _IT_STRS char *_cll1_it_strs(int i, char *s, ...) { int j=0;va_list ap; /* <-' */ va_start(ap,s); while(s!=(void *)&_cll1_it_strs && j++<i) s=va_arg(ap,char *); return s; }
 /* .----------------------------------------------------------------------.
   /  10. C<<1 globals and private macros, updated 2008-01-27 by xCh.
  '----------------------------------------------------------------------- */
index 4b0985900c707a45e1dd8e48ce1a2112039d8e57..32a2be3a5386af6b905de4e968efeb92d7c1b5ab 100644 (file)
@@ -13,10 +13,14 @@ program
  print("* coalesce():"); 
  print("We can",coalesce("print","everything"),coalesce(NULL,"everything"),"safely."); 
  print("* OFS");
+ OFS="";
+ EOL="";
+ print("We","Can","Print","Without","Spaces","BetweenArgs.");
  OFS=":";
- print("We","can","customize","print");
+ print("We","can","customize","print.");
  OFS="...";
  EOL="<--\n";
+ print("");
  print("* MAYBE ?");
  repeat(4) print((MAYBE ? "Hello" : "Hi"), (MAYBE ? "world" : "friend"), (MAYBE ? "!" : "?"));
  print("* WHOKNOWS ?");
diff --git a/demos/performance/cll1-echo.c b/demos/performance/cll1-echo.c
new file mode 100644 (file)
index 0000000..347d7af
--- /dev/null
@@ -0,0 +1,8 @@
+#include "cll1.h"
+
+program
+{
+ unsigned long i;
+ for_range(i,1,10000000)
+  echo("stuff\n");
+}
index f40ba699fcf061c86c340a904627ef44235d5b31..cd47ab288d5893d507e03d90370124b00e704ea2 100644 (file)
@@ -4,8 +4,9 @@
 int main()
 {
  unsigned long i;
- for (i=0;i<RUNS;i++) {
- std::cout << "stuff\n";
+ for (i=0;i<RUNS;i++) 
+ {
+  std::cout << "stuff\n";
  }
  return 0;
 }
index 6c84320d309efaf9f76a944a1ac1f5d580cf898a..9c03bd13e49514cbb7118d771c6dbd57b338e04c 100644 (file)
@@ -3,9 +3,10 @@
 #define RUNS 10000000UL
 int main (void)
 {
-unsigned long i;
-for (i=0;i<RUNS;i++) {
-fputs("stuff\n",stdout);
-}
-return 0;
+ unsigned long i;
+ for (i=0;i<RUNS;i++) 
+ {
+  fputs("stuff\n",stdout);
+ }
+ return 0;
 }
index 6d421edc07d6e9f84c57e4da16a6c5962f31062b..2d8b94994ddca67b32166fadbe2720947c071915 100755 (executable)
@@ -1,3 +1,4 @@
 #!/usr/bin/ruby
 
 10000000.times { print "stuff","\n" }
+
index 37f8e131636aebce7fc82d1ad7cce5a33aeba760..ac2a876466dc507b38a2e806fed65b01f733beb9 100755 (executable)
@@ -1,3 +1,4 @@
 #!/usr/bin/ruby
 
 10000000.times { print "stuff1"," ","stuff2","\n" }
+
index 81844fc63004ad123ad7f4d81aa08c66d02e8731..a256f2dbb6af89e1e47ef4ffadb47df2a5473799 100644 (file)
@@ -3,9 +3,10 @@
 #define RUNS 10000000UL
 int main (void)
 {
-unsigned long i;
-for (i=0;i<RUNS;i++) {
-printf("stuff\n");
-}
-return 0;
+ unsigned long i;
+ for (i=0;i<RUNS;i++) 
+ {
+  printf("stuff\n");
+ }
+ return 0;
 }
index 5ee4fb296f15ab31ea5bebe384705783ea8d1710..7320cd1d11762088cc980ba92b609a118390c0f6 100644 (file)
@@ -4,7 +4,8 @@
 int main (void)
 {
  unsigned long i;
- for (i=0;i<RUNS;i++) {
+ for (i=0;i<RUNS;i++) 
+ {
   printf("%s %s\n","stuff2","stuff2");
  }
  return 0;
index 77eac343a53909714e997366af87c0a1010e39a6..e48bbba078b0227248ec273ecc988a19f7dea298 100644 (file)
@@ -3,9 +3,10 @@
 #define RUNS 10000000UL
 int main (void)
 {
-unsigned long i;
-for (i=0;i<RUNS;i++) {
-puts("stuff"); 
-}
-return 0;
+ unsigned long i;
+ for (i=0;i<RUNS;i++) 
+ {
+  puts("stuff"); 
+ }
+ return 0;
 }
index 9c76b3f0c95e60f2671e33042b5118dc48e0ceea..89a8b3e37088e0574db3ac97d96699dc59e34ba4 100755 (executable)
-#!/bin/sh
+#!/bin/bash
 
+echo "------------------------------------------------------------- Ruby"
 cat print.rb
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./print.rb > /dev/null
-echo
+time ./print.rb > /dev/null
 
+echo "--------------------------------------------------- Python - range"
 cat print.py
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./print.py > /dev/null
-echo
+time ./print.py > /dev/null
 
+echo "-------------------------------------------------- Python - xrange"
 cat xrange.py
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./xrange.py > /dev/null
-echo
+time ./xrange.py > /dev/null
 
+echo "------------------------------------------------------------ PHP 5"
 cat echo.php
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./echo.php > /dev/null
-echo
+time ./echo.php > /dev/null
 
+echo "-------------------------------------------------- C - gcc - write"
 cat write.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 write.c -o write
+time gcc -O2 write.c -o write
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./write > /dev/null
+time ./write > /dev/null
 
+echo "------------------------------------------------------------- Perl"
 cat print.pl
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./print.pl > /dev/null
-echo
+time ./print.pl > /dev/null
 
+echo "----------------------------------------------- C<<1 - gcc - print"
+cat cll1-print.c
+echo -n "Compiling..."
+time gcc -O2 cll1-print.c -o cll1-print
+echo -n "Running..."
+time ./cll1-print > /dev/null
+
+echo "---------------------------------------------- C - g++ - std::cout"
 cat cout.cpp
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" g++ -O2 cout.cpp -o cout
+time g++ -O2 cout.cpp -o cout
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./cout > /dev/null
+time ./cout > /dev/null
 
-echo
-cat cll1-print.c
+#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"
+cat cll1-echo.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 cll1-print.c -o cll1-print
+time gcc -O2 cll1-echo.c -o cll1-echo
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./cll1-print > /dev/null
-echo
+time ./cll1-echo > /dev/null
 
+echo "------------------------------------------------- C - gcc - printf"
 cat printf.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 printf.c -o printf
+time gcc -O2 printf.c -o printf
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./printf > /dev/null
-echo
+time ./printf > /dev/null
 
+echo "--------------------------------------------------- C - gcc - puts"
 cat puts.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 puts.c -o puts
+time gcc -O2 puts.c -o puts
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./puts > /dev/null
-echo
+time ./puts > /dev/null
 
-cat fputs.c
+echo "------------------------------------------------- C - gcc - fwrite"
+cat fwrite.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 fputs.c -o fputs
+time gcc -O2 fwrite.c -o fwrite
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./fputs > /dev/null
-echo
+time ./fwrite > /dev/null
 
-cat fwrite.c
+echo "-------------------------------------------------- C - gcc - fputs"
+cat fputs.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 fwrite.c -o fwrite
+time gcc -O2 fputs.c -o fputs
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./fwrite > /dev/null
+time ./fputs > /dev/null
index a4006d2427f91e51744bb5b8e05129be085ce3ee..b545771603b3980c30ae6315500075e9da73075d 100755 (executable)
-#!/bin/sh
+#!/bin/bash
 
+echo "------------------------------------------------------------- Ruby"
 cat print2.rb
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./print2.rb > /dev/null
+time ./print2.rb > /dev/null
 echo
 
+echo "--------------------------------------------------- Python - range"
 cat print2.py
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./print2.py > /dev/null
+time ./print2.py > /dev/null
 echo
 
+echo "-------------------------------------------------- Python - xrange"
 cat xrange2.py
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./xrange2.py > /dev/null
+time ./xrange2.py > /dev/null
 echo
 
+echo "------------------------------------------------------------ PHP 5"
 cat echo2.php
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./echo2.php > /dev/null
+time -f  "%E total, %U user, %S sys" ./echo2.php > /dev/null
 echo
 
+echo "-------------------------------------------------- C - gcc - write"
 cat write2.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 write2.c -o write2
+time gcc -O2 write2.c -o write2
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./write2 > /dev/null
+time ./write2 > /dev/null
 echo
 
+echo "---------------------------------------------- C - g++ - std::cout"
 cat cout2.cpp
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" g++ -O2 cout2.cpp -o cout2
+time g++ -O2 cout2.cpp -o cout2
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./cout2 > /dev/null
+time ./cout2 > /dev/null
 echo
 
+echo "------------------------------------------------------------- Perl"
 cat print2.pl
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./print2.pl > /dev/null
+time -f  "%E total, %U user, %S sys" ./print2.pl > /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..."
-time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 printf2.c -o printf2
+time gcc -O2 printf2.c -o printf2
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./printf2 > /dev/null
+time ./printf2 > /dev/null
 echo
 
-
-cat cll1-print2.c
+echo "------------------------------------------------- C - gcc - fwrite"
+cat fwrite2.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 cll1-print2.c -o cll1-print2
+time gcc -O2 fwrite2.c -o fwrite2
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./cll1-print2 > /dev/null
+time ./fwrite2 > /dev/null
 echo
 
-cat fputs2.c
+echo "----------------------------------------------- C<<1 - gcc - print"
+cat cll1-print2.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 fputs2.c -o fputs2
+time gcc -O2 cll1-print2.c -o cll1-print2
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./fputs2 > /dev/null
+time ./cll1-print2 > /dev/null
 echo
 
-cat fwrite2.c
+echo "-------------------------------------------------- C - gcc - fputs"
+cat fputs2.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 fwrite2.c -o fwrite2
+time gcc -O2 fputs2.c -o fputs2
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %F page faults" ./fwrite2 > /dev/null
+time ./fputs2 > /dev/null
 echo
index 9709fc5044df8124ed531b13c7f2a73e15c46cdd..af9d68bcd4444d512b4ea9eae1025886e69dbee6 100644 (file)
@@ -1,22 +1,33 @@
+------------------------------------------------------------- Ruby
 #!/usr/bin/ruby
 
 10000000.times { print "stuff","\n" }
-Running...0:15.62 total, 14.06 user, 1.55 sys, 0 page faults
 
+Running...
+real   0m16.104s
+user   0m14.353s
+sys    0m1.412s
+--------------------------------------------------- Python - range
 #!/usr/bin/python
 
 for i in range(1,10000000):
  print "stuff"
 
-Running...0:08.64 total, 8.43 user, 0.21 sys, 0 page faults
-
+Running...
+real   0m8.661s
+user   0m8.465s
+sys    0m0.168s
+-------------------------------------------------- Python - xrange
 #!/usr/bin/python
 
 for i in xrange(1,10000000):
  print "stuff"
 
-Running...0:08.19 total, 8.17 user, 0.00 sys, 0 page faults
-
+Running...
+real   0m8.480s
+user   0m8.433s
+sys    0m0.016s
+------------------------------------------------------------ PHP 5
 #!/usr/bin/php5 -q
 <?php
 for ( $i=0; $i<10000000; $i++ )
@@ -24,8 +35,11 @@ for ( $i=0; $i<10000000; $i++ )
  echo "stuff1\n";
 }
 ?>
-Running...0:07.08 total, 5.00 user, 2.07 sys, 0 page faults
-
+Running...
+real   0m7.098s
+user   0m5.048s
+sys    0m2.024s
+-------------------------------------------------- C - gcc - write
 #include <string.h>
 
 #define RUNS 10000000UL
@@ -35,14 +49,21 @@ int main (void)
  char *s1="stuff\n";
  int l1=strlen(s1);
 
-for (i=0;i<RUNS;i++)
-{
- write(1,s1,l1);
-}
-return 0;
+ for (i=0;i<RUNS;i++)
+ {
 write(1,s1,l1);
+ }
+ return 0;
 }
-Compiling...0:00.06 total, 0.05 user, 0.00 sys, 0 page faults
-Running...0:02.90 total, 0.90 user, 2.00 sys, 0 page faults
+Compiling...
+real   0m0.061s
+user   0m0.048s
+sys    0m0.012s
+Running...
+real   0m2.906s
+user   0m0.848s
+sys    0m2.028s
+------------------------------------------------------------- Perl
 #!/usr/bin/perl
 
 my $i=0;
@@ -51,74 +72,107 @@ for ($i=0;$i<10000000;$i++)
  print ("stuff");
 }
 
-Running...0:02.44 total, 2.44 user, 0.00 sys, 0 page faults
+Running...
+real   0m2.515s
+user   0m2.484s
+sys    0m0.008s
+----------------------------------------------- C<<1 - gcc - print
+#include "cll1.h"
 
+program
+{
+ repeat(10000000)
+  print("stuff");
+}
+Compiling...
+real   0m0.121s
+user   0m0.112s
+sys    0m0.008s
+Running...
+real   0m1.249s
+user   0m1.240s
+sys    0m0.004s
+---------------------------------------------- C - g++ - std::cout
 #include <iostream>
 
 #define RUNS 10000000UL
 int main()
 {
  unsigned long i;
- for (i=0;i<RUNS;i++) {
- std::cout << "stuff\n";
+ for (i=0;i<RUNS;i++) 
+ {
+  std::cout << "stuff\n";
  }
  return 0;
 }
-Compiling...0:00.37 total, 0.35 user, 0.01 sys, 0 page faults
-Running...0:00.99 total, 0.99 user, 0.00 sys, 0 page faults
-
+Compiling...
+real   0m0.362s
+user   0m0.320s
+sys    0m0.036s
+Running...
+real   0m0.990s
+user   0m0.984s
+sys    0m0.004s
+-----------------------------------------------= C<<1 - gcc - echo
 #include "cll1.h"
 
 program
 {
- repeat(10000000)
-  print("stuff");
-}
-Compiling...0:00.12 total, 0.12 user, 0.00 sys, 0 page faults
-Running...0:01.23 total, 1.23 user, 0.00 sys, 0 page faults
-
-#include <stdio.h>
-
-#define RUNS 10000000UL
-int main (void)
-{
-unsigned long i;
-for (i=0;i<RUNS;i++) {
-printf("stuff\n");
-}
-return 0;
+ unsigned long i;
+ for_range(i,1,10000000)
+  echo("stuff\n");
 }
-Compiling...0:00.05 total, 0.04 user, 0.02 sys, 0 page faults
-Running...0:00.62 total, 0.62 user, 0.00 sys, 0 page faults
-
+Compiling...
+real   0m0.117s
+user   0m0.100s
+sys    0m0.008s
+Running...
+real   0m0.757s
+user   0m0.744s
+sys    0m0.000s
+------------------------------------------------- C - gcc - printf
 #include <stdio.h>
 
 #define RUNS 10000000UL
 int main (void)
 {
-unsigned long i;
-for (i=0;i<RUNS;i++) {
-puts("stuff"); 
-}
-return 0;
+ unsigned long i;
+ for (i=0;i<RUNS;i++) 
+ {
+  printf("stuff\n");
+ }
+ return 0;
 }
-Compiling...0:00.05 total, 0.04 user, 0.01 sys, 0 page faults
-Running...0:00.62 total, 0.62 user, 0.00 sys, 0 page faults
-
+Compiling...
+real   0m0.067s
+user   0m0.040s
+sys    0m0.024s
+Running...
+real   0m0.630s
+user   0m0.608s
+sys    0m0.012s
+--------------------------------------------------- C - gcc - puts
 #include <stdio.h>
 
 #define RUNS 10000000UL
 int main (void)
 {
-unsigned long i;
-for (i=0;i<RUNS;i++) {
-fputs("stuff\n",stdout);
-}
-return 0;
+ unsigned long i;
+ for (i=0;i<RUNS;i++) 
+ {
+  puts("stuff"); 
+ }
+ return 0;
 }
-Compiling...0:00.06 total, 0.05 user, 0.00 sys, 0 page faults
-Running...0:00.56 total, 0.56 user, 0.00 sys, 0 page faults
-
+Compiling...
+real   0m0.058s
+user   0m0.036s
+sys    0m0.024s
+Running...
+real   0m0.633s
+user   0m0.632s
+sys    0m0.000s
+------------------------------------------------- C - gcc - fwrite
 #include <stdio.h>
 #include <string.h>
 
@@ -135,5 +189,32 @@ int main (void)
  }
  return 0;
 }
-Compiling...0:00.06 total, 0.05 user, 0.01 sys, 0 page faults
-Running...0:00.53 total, 0.53 user, 0.00 sys, 0 page faults
+Compiling...
+real   0m0.137s
+user   0m0.060s
+sys    0m0.008s
+Running...
+real   0m0.555s
+user   0m0.548s
+sys    0m0.004s
+-------------------------------------------------- C - gcc - 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.058s
+user   0m0.040s
+sys    0m0.016s
+Running...
+real   0m0.551s
+user   0m0.548s
+sys    0m0.004s
index 315cb2a680b1abb6f33b35ab2a42ea5e63f6eebc..b451d20627e836d2997ac7fc06fbd27bf0f2aed0 100644 (file)
@@ -1,22 +1,36 @@
+------------------------------------------------------------- Ruby
 #!/usr/bin/ruby
 
 10000000.times { print "stuff1"," ","stuff2","\n" }
-Running...0:23.81 total, 22.24 user, 1.55 sys, 0 page faults
 
+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...0:13.72 total, 13.54 user, 0.18 sys, 0 page faults
+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...0:13.39 total, 13.38 user, 0.00 sys, 0 page faults
+Running...
+real   0m13.118s
+user   0m13.105s
+sys    0m0.012s
 
+------------------------------------------------------------ PHP 5
 #!/usr/bin/php5 -q
 <?php 
 for ( $i=0; $i<10000000; $i++ )
@@ -24,9 +38,13 @@ for ( $i=0; $i<10000000; $i++ )
  echo "stuff1"." "."stuff2"."\n";
 }
 ?>
-Running...0:11.89 total, 9.90 user, 1.98 sys, 0 page faults
+Running..../test-performance2.sh: line 24: -f: command not found
 
-#include <stdio.h>
+real   0m0.001s
+user   0m0.000s
+sys    0m0.000s
+
+-------------------------------------------------- C - gcc - write
 #include <string.h>
 
 #define RUNS 10000000UL
@@ -47,9 +65,16 @@ int main (void)
  }
  return 0;
 }
-Compiling...0:00.06 total, 0.04 user, 0.02 sys, 0 page faults
-Running...0:11.79 total, 2.92 user, 8.85 sys, 0 page faults
-
+Compiling...
+real   0m0.063s
+user   0m0.044s
+sys    0m0.016s
+Running...
+real   0m11.514s
+user   0m3.572s
+sys    0m7.928s
+
+---------------------------------------------- C - g++ - std::cout
 #include <iostream>
 
 #define RUNS 10000000UL
@@ -61,9 +86,16 @@ int main()
  }
  return 0;
 }
-Compiling...0:00.37 total, 0.35 user, 0.02 sys, 0 page faults
-Running...0:08.00 total, 5.91 user, 2.08 sys, 0 page faults
-
+Compiling...
+real   0m0.367s
+user   0m0.336s
+sys    0m0.024s
+Running...
+real   0m8.012s
+user   0m6.092s
+sys    0m1.812s
+
+------------------------------------------------------------- Perl
 #!/usr/bin/perl
 
 my $i=0;
@@ -71,22 +103,66 @@ for ($i=0;$i<10000000;$i++)
 {
  print ("stuff1"," ","stuff2","\n");
 }
-Running...0:05.69 total, 5.68 user, 0.00 sys, 0 page faults
+Running..../test-performance2.sh: line 46: -f: command not found
+
+real   0m0.001s
+user   0m0.000s
+sys    0m0.004s
 
+------------------------------------------------- C - gcc - printf
 #include <stdio.h>
 
 #define RUNS 10000000UL
 int main (void)
 {
  unsigned long i;
- for (i=0;i<RUNS;i++) {
+ for (i=0;i<RUNS;i++) 
+ {
   printf("%s %s\n","stuff2","stuff2");
  }
  return 0;
 }
-Compiling...0:00.06 total, 0.04 user, 0.01 sys, 0 page faults
-Running...0:02.80 total, 2.80 user, 0.00 sys, 0 page faults
+Compiling...
+real   0m0.098s
+user   0m0.080s
+sys    0m0.016s
+Running...
+real   0m2.818s
+user   0m2.820s
+sys    0m0.000s
+
+------------------------------------------------- C - gcc - 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.070s
+user   0m0.052s
+sys    0m0.016s
+Running...
+real   0m2.665s
+user   0m2.624s
+sys    0m0.012s
+
+----------------------------------------------- C<<1 - gcc - print
 #include "cll1.h"
 
 program
@@ -94,9 +170,16 @@ program
  repeat(10000000)
   print("stuff1","stuff2");
 }
-Compiling...0:00.13 total, 0.11 user, 0.01 sys, 0 page faults
-Running...0:02.47 total, 2.47 user, 0.00 sys, 0 page faults
-
+Compiling...
+real   0m0.121s
+user   0m0.100s
+sys    0m0.016s
+Running...
+real   0m2.510s
+user   0m2.508s
+sys    0m0.004s
+
+-------------------------------------------------- C - gcc - fputs
 #include <stdio.h>
 
 #define RUNS 10000000UL
@@ -111,30 +194,12 @@ int main (void)
  }
  return 0;
 }
-Compiling...0:00.06 total, 0.04 user, 0.02 sys, 0 page faults
-Running...0:01.51 total, 1.50 user, 0.00 sys, 0 page faults
-
-#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...0:00.07 total, 0.06 user, 0.01 sys, 0 page faults
-Running...0:02.56 total, 2.56 user, 0.00 sys, 0 page faults
+Compiling...
+real   0m0.060s
+user   0m0.052s
+sys    0m0.008s
+Running...
+real   0m1.567s
+user   0m1.560s
+sys    0m0.008s
 
index 2f987900529d0b79cc0630b026195fb867576701..8907668311a958b070123891a031208d9d18de18 100644 (file)
@@ -7,9 +7,9 @@ int main (void)
  char *s1="stuff\n";
  int l1=strlen(s1);
 
-for (i=0;i<RUNS;i++)
-{
- write(1,s1,l1);
-}
-return 0;
+ for (i=0;i<RUNS;i++)
+ {
 write(1,s1,l1);
+ }
+ return 0;
 }
index 56ffdc67fbc6e44bb588e2b589d0bf3fab234f96..a3ee4c6c8ab80db2d950bc40bd8e869b2c6c9a5a 100644 (file)
@@ -1,4 +1,3 @@
-#include <stdio.h>
 #include <string.h>
 
 #define RUNS 10000000UL
This page took 0.583782 seconds and 4 git commands to generate.