From b84246fd4f755e89ebc846521457cfb626faec21 Mon Sep 17 00:00:00 2001 From: xchaos Date: Tue, 22 Jan 2008 13:32:02 +0000 Subject: [PATCH] ruby performance test added git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@28 4bb87942-c103-4e5a-b51c-0ebff58f8515 --- demos/performance/print.rb | 3 ++ demos/performance/print2.rb | 3 ++ demos/performance/test-performance.sh | 4 +++ demos/performance/test-performance2.sh | 4 +++ demos/performance/test-results | 48 +++++++++++++++----------- demos/performance/test-results2 | 38 +++++++++++--------- 6 files changed, 63 insertions(+), 37 deletions(-) create mode 100755 demos/performance/print.rb create mode 100755 demos/performance/print2.rb diff --git a/demos/performance/print.rb b/demos/performance/print.rb new file mode 100755 index 0000000..6d421ed --- /dev/null +++ b/demos/performance/print.rb @@ -0,0 +1,3 @@ +#!/usr/bin/ruby + +10000000.times { print "stuff","\n" } diff --git a/demos/performance/print2.rb b/demos/performance/print2.rb new file mode 100755 index 0000000..37f8e13 --- /dev/null +++ b/demos/performance/print2.rb @@ -0,0 +1,3 @@ +#!/usr/bin/ruby + +10000000.times { print "stuff1"," ","stuff2","\n" } diff --git a/demos/performance/test-performance.sh b/demos/performance/test-performance.sh index 45b5675..31bb47d 100755 --- a/demos/performance/test-performance.sh +++ b/demos/performance/test-performance.sh @@ -1,5 +1,9 @@ #!/bin/sh +cat print.rb +echo "Running..." +time ./print.rb > /dev/null + cat print.py echo "Running..." time ./print.py > /dev/null diff --git a/demos/performance/test-performance2.sh b/demos/performance/test-performance2.sh index 50f2eef..d0ef063 100755 --- a/demos/performance/test-performance2.sh +++ b/demos/performance/test-performance2.sh @@ -4,6 +4,10 @@ cat print2.py echo "Running..." time ./print2.py > /dev/null +cat print2.rb +echo "Running..." +time ./print2.rb > /dev/null + cat cout2.cpp echo "Compiling..." time g++ -O4 cout2.cpp -o cout2 diff --git a/demos/performance/test-results b/demos/performance/test-results index 192a927..4a25893 100644 --- a/demos/performance/test-results +++ b/demos/performance/test-results @@ -1,11 +1,17 @@ +#!/usr/bin/ruby + +10000000.times { print "stuff","\n" } +Running... +14.71user 1.44system 0:16.17elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+457minor)pagefaults 0swaps #!/usr/bin/python for i in range(1,10000000): print "stuff" Running... -8.45user 0.16system 0:08.67elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+39997minor)pagefaults 0swaps +8.33user 0.17system 0:08.51elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+39998minor)pagefaults 0swaps #include #define RUNS 10000000UL @@ -18,10 +24,10 @@ int main() return 0; } Compiling... -0.32user 0.06system 0:00.47elapsed 81%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (7major+8814minor)pagefaults 0swaps +0.34user 0.05system 0:00.38elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+8820minor)pagefaults 0swaps Running... -3.54user 2.18system 0:05.73elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k +3.59user 2.17system 0:05.78elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+241minor)pagefaults 0swaps #!/usr/bin/perl @@ -32,8 +38,8 @@ for ($i=0;$i<10000000;$i++) } Running... -2.51user 0.01system 0:02.52elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+425minor)pagefaults 0swaps +2.51user 0.00system 0:02.51elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+424minor)pagefaults 0swaps #include "cll1.h" program @@ -42,10 +48,10 @@ program print("stuff"); } Compiling... -0.12user 0.01system 0:00.30elapsed 42%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (17major+3993minor)pagefaults 0swaps +0.08user 0.02system 0:00.10elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+4013minor)pagefaults 0swaps Running... -0.87user 0.00system 0:00.87elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0.88user 0.00system 0:00.88elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+130minor)pagefaults 0swaps #include @@ -59,10 +65,10 @@ printf("stuff\n"); return 0; } Compiling... -0.03user 0.02system 0:00.05elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+3783minor)pagefaults 0swaps +0.04user 0.01system 0:00.06elapsed 104%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+3781minor)pagefaults 0swaps Running... -0.62user 0.00system 0:00.63elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0.62user 0.00system 0:00.61elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+115minor)pagefaults 0swaps #include @@ -76,11 +82,11 @@ puts("stuff"); return 0; } Compiling... -0.05user 0.00system 0:00.05elapsed 96%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+3780minor)pagefaults 0swaps +0.05user 0.00system 0:00.05elapsed 103%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+3781minor)pagefaults 0swaps Running... -0.62user 0.00system 0:00.63elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+114minor)pagefaults 0swaps +0.67user 0.00system 0:00.68elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+115minor)pagefaults 0swaps #include #define RUNS 10000000UL @@ -93,8 +99,8 @@ fputs("stuff\n",stdout); return 0; } Compiling... -0.04user 0.01system 0:00.05elapsed 101%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+3787minor)pagefaults 0swaps +0.04user 0.02system 0:00.06elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+3786minor)pagefaults 0swaps Running... -0.54user 0.00system 0:00.53elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+114minor)pagefaults 0swaps +0.57user 0.00system 0:00.57elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+115minor)pagefaults 0swaps diff --git a/demos/performance/test-results2 b/demos/performance/test-results2 index 5e4bd74..afe0d4d 100644 --- a/demos/performance/test-results2 +++ b/demos/performance/test-results2 @@ -4,8 +4,14 @@ for i in range(1,10000000): print "stuff1","stuff2" Running... -13.25user 0.17system 0:13.42elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +13.76user 0.19system 0:13.98elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+39997minor)pagefaults 0swaps +#!/usr/bin/ruby + +10000000.times { print "stuff1"," ","stuff2","\n" } +Running... +23.17user 1.58system 0:24.78elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+457minor)pagefaults 0swaps #include #define RUNS 10000000UL @@ -18,11 +24,11 @@ int main() return 0; } Compiling... -0.35user 0.02system 0:00.37elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k +0.34user 0.04system 0:00.39elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+8824minor)pagefaults 0swaps Running... -7.43user 2.18system 0:09.63elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+241minor)pagefaults 0swaps +6.14user 1.98system 0:08.12elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+240minor)pagefaults 0swaps #!/usr/bin/perl my $i=0; @@ -31,8 +37,8 @@ for ($i=0;$i<10000000;$i++) print ("stuff1"," ","stuff2","\n"); } Running... -5.54user 0.00system 0:05.55elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+425minor)pagefaults 0swaps +5.68user 0.01system 0:05.71elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+426minor)pagefaults 0swaps #include "cll1.h" program @@ -41,10 +47,10 @@ program print("stuff1","stuff2"); } Compiling... -0.09user 0.00system 0:00.09elapsed 97%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+4012minor)pagefaults 0swaps +0.07user 0.02system 0:00.10elapsed 102%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+4011minor)pagefaults 0swaps Running... -1.69user 0.01system 0:01.70elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +1.72user 0.00system 0:01.73elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+130minor)pagefaults 0swaps #include @@ -58,11 +64,11 @@ int main (void) return 0; } Compiling... -0.04user 0.00system 0:00.05elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0.04user 0.01system 0:00.06elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+3782minor)pagefaults 0swaps Running... -2.94user 0.01system 0:02.95elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+123minor)pagefaults 0swaps +2.99user 0.00system 0:03.00elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+121minor)pagefaults 0swaps #include #define RUNS 10000000UL @@ -78,8 +84,8 @@ int main (void) return 0; } Compiling... -0.04user 0.01system 0:00.05elapsed 101%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+3790minor)pagefaults 0swaps +0.06user 0.00system 0:00.06elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+3792minor)pagefaults 0swaps Running... -1.54user 0.00system 0:01.54elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k -0inputs+0outputs (0major+115minor)pagefaults 0swaps +1.46user 0.01system 0:01.47elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k +0inputs+0outputs (0major+116minor)pagefaults 0swaps -- 2.30.2