fwrite test added
authorxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Mon, 28 Jan 2008 21:29:49 +0000 (21:29 +0000)
committerxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Mon, 28 Jan 2008 21:29:49 +0000 (21:29 +0000)
git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@47 4bb87942-c103-4e5a-b51c-0ebff58f8515

demos/performance/fwrite.c [new file with mode: 0644]
demos/performance/fwrite2.c [new file with mode: 0644]
demos/performance/test-performance.sh
demos/performance/test-performance2.sh
demos/performance/test-results
demos/performance/test-results2

diff --git a/demos/performance/fwrite.c b/demos/performance/fwrite.c
new file mode 100644 (file)
index 0000000..a8f3c5b
--- /dev/null
@@ -0,0 +1,16 @@
+#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;
+}
diff --git a/demos/performance/fwrite2.c b/demos/performance/fwrite2.c
new file mode 100644 (file)
index 0000000..30e345a
--- /dev/null
@@ -0,0 +1,21 @@
+#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;
+}
index cadcbfd1090bbd372f64dfce284479449ce3cb70..9c76b3f0c95e60f2671e33042b5118dc48e0ceea 100755 (executable)
@@ -2,59 +2,72 @@
 
 cat print.rb
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./print.rb > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./print.rb > /dev/null
 echo
 
 cat print.py
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./print.py > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./print.py > /dev/null
 echo
 
 cat xrange.py
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./xrange.py > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./xrange.py > /dev/null
 echo
 
 cat echo.php
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./echo.php > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./echo.php > /dev/null
 echo
 
 cat write.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %O outputs" gcc -O2 write.c -o write
+time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 write.c -o write
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./write > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./write > /dev/null
 
 cat print.pl
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./print.pl > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./print.pl > /dev/null
 echo
 
 cat cout.cpp
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %O outputs" g++ -O2 cout.cpp -o cout
+time -f  "%E total, %U user, %S sys, %F page faults" g++ -O2 cout.cpp -o cout
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./cout > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./cout > /dev/null
 
 echo
 cat cll1-print.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %O outputs" gcc -O2 cll1-print.c -o cll1-print
+time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 cll1-print.c -o cll1-print
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./cll1-print > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./cll1-print > /dev/null
 echo
 
 cat printf.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %O outputs" gcc -O2 printf.c -o printf
+time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 printf.c -o printf
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./printf > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./printf > /dev/null
 echo
 
 cat puts.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %O outputs" gcc -O2 puts.c -o puts
+time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 puts.c -o puts
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./puts > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./puts > /dev/null
 echo
+
+cat fputs.c
+echo -n "Compiling..."
+time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 fputs.c -o fputs
+echo -n "Running..."
+time -f  "%E total, %U user, %S sys, %F page faults" ./fputs > /dev/null
+echo
+
+cat fwrite.c
+echo -n "Compiling..."
+time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 fwrite.c -o fwrite
+echo -n "Running..."
+time -f  "%E total, %U user, %S sys, %F page faults" ./fwrite > /dev/null
index b75ce5c23c8c22b81af83747dcb797a965bb18d7..a4006d2427f91e51744bb5b8e05129be085ce3ee 100755 (executable)
@@ -2,60 +2,68 @@
 
 cat print2.rb
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./print2.rb > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./print2.rb > /dev/null
 echo
 
 cat print2.py
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./print2.py > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./print2.py > /dev/null
 echo
 
 cat xrange2.py
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./xrange2.py > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./xrange2.py > /dev/null
 echo
 
 cat echo2.php
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./echo2.php > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./echo2.php > /dev/null
 echo
 
 cat write2.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %O outputs" gcc -O2 write2.c -o write2
+time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 write2.c -o write2
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./write2 > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./write2 > /dev/null
 echo
 
 cat cout2.cpp
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %O outputs" g++ -O2 cout2.cpp -o cout2
+time -f  "%E total, %U user, %S sys, %F page faults" g++ -O2 cout2.cpp -o cout2
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./cout2 > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./cout2 > /dev/null
 echo
 
 cat print2.pl
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./print2.pl > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./print2.pl > /dev/null
 echo
 
 cat printf2.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %O outputs" gcc -O2 printf2.c -o printf2
+time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 printf2.c -o printf2
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./printf2 > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./printf2 > /dev/null
 echo
 
+
 cat cll1-print2.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %O outputs" gcc -O2 cll1-print2.c -o cll1-print2
+time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 cll1-print2.c -o cll1-print2
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./cll1-print2 > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./cll1-print2 > /dev/null
 echo
 
 cat fputs2.c
 echo -n "Compiling..."
-time -f  "%E total, %U user, %S sys, %O outputs" gcc -O2 fputs2.c -o fputs2
+time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 fputs2.c -o fputs2
+echo -n "Running..."
+time -f  "%E total, %U user, %S sys, %F page faults" ./fputs2 > /dev/null
+echo
+
+cat fwrite2.c
+echo -n "Compiling..."
+time -f  "%E total, %U user, %S sys, %F page faults" gcc -O2 fwrite2.c -o fwrite2
 echo -n "Running..."
-time -f  "%E total, %U user, %S sys, %O outputs" ./fputs2 > /dev/null
+time -f  "%E total, %U user, %S sys, %F page faults" ./fwrite2 > /dev/null
 echo
index 0f94f3049caeaee604d48dda021c625d1b5ec590..9709fc5044df8124ed531b13c7f2a73e15c46cdd 100644 (file)
@@ -1,21 +1,21 @@
 #!/usr/bin/ruby
 
 10000000.times { print "stuff","\n" }
-Running...0:16.24 total, 14.59 user, 1.63 sys, 0 outputs
+Running...0:15.62 total, 14.06 user, 1.55 sys, 0 page faults
 
 #!/usr/bin/python
 
 for i in range(1,10000000):
  print "stuff"
 
-Running...0:08.79 total, 8.57 user, 0.14 sys, 0 outputs
+Running...0:08.64 total, 8.43 user, 0.21 sys, 0 page faults
 
 #!/usr/bin/python
 
 for i in xrange(1,10000000):
  print "stuff"
 
-Running...0:08.34 total, 8.22 user, 0.01 sys, 0 outputs
+Running...0:08.19 total, 8.17 user, 0.00 sys, 0 page faults
 
 #!/usr/bin/php5 -q
 <?php
@@ -24,7 +24,7 @@ for ( $i=0; $i<10000000; $i++ )
  echo "stuff1\n";
 }
 ?>
-Running...0:07.05 total, 4.83 user, 2.10 sys, 0 outputs
+Running...0:07.08 total, 5.00 user, 2.07 sys, 0 page faults
 
 #include <string.h>
 
@@ -41,8 +41,8 @@ for (i=0;i<RUNS;i++)
 }
 return 0;
 }
-Compiling...0:00.06 total, 0.05 user, 0.00 sys, 0 outputs
-Running...0:02.93 total, 0.86 user, 2.06 sys, 0 outputs
+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
 #!/usr/bin/perl
 
 my $i=0;
@@ -51,7 +51,7 @@ for ($i=0;$i<10000000;$i++)
  print ("stuff");
 }
 
-Running...0:02.60 total, 2.57 user, 0.01 sys, 0 outputs
+Running...0:02.44 total, 2.44 user, 0.00 sys, 0 page faults
 
 #include <iostream>
 
@@ -64,8 +64,8 @@ int main()
  }
  return 0;
 }
-Compiling...0:00.39 total, 0.34 user, 0.05 sys, 0 outputs
-Running...0:01.02 total, 0.98 user, 0.01 sys, 0 outputs
+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
 
 #include "cll1.h"
 
@@ -74,8 +74,8 @@ program
  repeat(10000000)
   print("stuff");
 }
-Compiling...0:00.13 total, 0.12 user, 0.01 sys, 0 outputs
-Running...0:01.25 total, 1.23 user, 0.00 sys, 0 outputs
+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>
 
@@ -88,8 +88,8 @@ printf("stuff\n");
 }
 return 0;
 }
-Compiling...0:00.06 total, 0.04 user, 0.01 sys, 0 outputs
-Running...0:00.62 total, 0.60 user, 0.00 sys, 0 outputs
+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
 
 #include <stdio.h>
 
@@ -102,6 +102,38 @@ puts("stuff");
 }
 return 0;
 }
-Compiling...0:00.06 total, 0.05 user, 0.00 sys, 0 outputs
-Running...0:00.63 total, 0.63 user, 0.00 sys, 0 outputs
+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
 
+#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...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
+
+#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...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
index ea395b5de8ab1190fd3c37c9defc59891b54a4fb..315cb2a680b1abb6f33b35ab2a42ea5e63f6eebc 100644 (file)
@@ -1,21 +1,21 @@
 #!/usr/bin/ruby
 
 10000000.times { print "stuff1"," ","stuff2","\n" }
-Running...0:24.57 total, 23.03 user, 1.51 sys, 0 outputs
+Running...0:23.81 total, 22.24 user, 1.55 sys, 0 page faults
 
 #!/usr/bin/python
 
 for i in range(1,10000000):
  print "stuff1","stuff2"
 
-Running...0:13.80 total, 13.53 user, 0.17 sys, 0 outputs
+Running...0:13.72 total, 13.54 user, 0.18 sys, 0 page faults
 
 #!/usr/bin/python
 
 for i in xrange(1,10000000):
  print "stuff1","stuff2"
 
-Running...0:13.43 total, 13.20 user, 0.02 sys, 0 outputs
+Running...0:13.39 total, 13.38 user, 0.00 sys, 0 page faults
 
 #!/usr/bin/php5 -q
 <?php 
@@ -24,7 +24,7 @@ for ( $i=0; $i<10000000; $i++ )
  echo "stuff1"." "."stuff2"."\n";
 }
 ?>
-Running...0:11.93 total, 9.84 user, 2.08 sys, 0 outputs
+Running...0:11.89 total, 9.90 user, 1.98 sys, 0 page faults
 
 #include <stdio.h>
 #include <string.h>
@@ -47,8 +47,8 @@ int main (void)
  }
  return 0;
 }
-Compiling...0:00.07 total, 0.06 user, 0.00 sys, 0 outputs
-Running...0:11.92 total, 3.78 user, 7.86 sys, 0 outputs
+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
 
 #include <iostream>
 
@@ -61,8 +61,8 @@ int main()
  }
  return 0;
 }
-Compiling...0:00.38 total, 0.33 user, 0.05 sys, 0 outputs
-Running...0:08.22 total, 6.18 user, 2.01 sys, 0 outputs
+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
 
 #!/usr/bin/perl
 
@@ -71,7 +71,7 @@ for ($i=0;$i<10000000;$i++)
 {
  print ("stuff1"," ","stuff2","\n");
 }
-Running...0:05.97 total, 5.96 user, 0.00 sys, 0 outputs
+Running...0:05.69 total, 5.68 user, 0.00 sys, 0 page faults
 
 #include <stdio.h>
 
@@ -84,8 +84,8 @@ int main (void)
  }
  return 0;
 }
-Compiling...0:00.06 total, 0.05 user, 0.00 sys, 0 outputs
-Running...0:02.87 total, 2.84 user, 0.01 sys, 0 outputs
+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
 
 #include "cll1.h"
 
@@ -94,8 +94,8 @@ program
  repeat(10000000)
   print("stuff1","stuff2");
 }
-Compiling...0:00.14 total, 0.12 user, 0.00 sys, 0 outputs
-Running...0:02.77 total, 2.76 user, 0.00 sys, 0 outputs
+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
 
 #include <stdio.h>
 
@@ -111,6 +111,30 @@ int main (void)
  }
  return 0;
 }
-Compiling...0:00.07 total, 0.04 user, 0.02 sys, 0 outputs
-Running...0:01.52 total, 1.52 user, 0.00 sys, 0 outputs
+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
 
This page took 0.348186 seconds and 4 git commands to generate.