-#!/usr/bin/ruby
+AMD Athlon(tm) XP 1259.487 Mhz 2522.30 bogomips
+-------------------------------------------------- C - gcc - write
+#include <string.h>
-10000000.times { print "stuff1"," ","stuff2","\n" }
-Running...0:24.98 total, 23.33 user, 1.54 sys, 0 KB average size
-
-#!/usr/bin/python
-
-for i in range(1,10000000):
- print "stuff1","stuff2"
-
-Running...0:13.82 total, 13.59 user, 0.19 sys, 0 KB average size
-
-#!/usr/bin/python
-
-for i in xrange(1,10000000):
- print "stuff1","stuff2"
-
-Running...0:13.24 total, 13.22 user, 0.00 sys, 0 KB average size
-
-#!/usr/bin/php5 -q
-<?php
-for ( $i=0; $i<10000000; $i++ )
+#define RUNS 10000000UL
+int main (void)
{
- echo "stuff1"." "."stuff2"."\n";
+ unsigned long i;
+ char *s1="stuff1";
+ char *s2="stuff2";
+ int l1=strlen(s1);
+ int l2=strlen(s2);
+
+ for (i=0;i<RUNS;i++)
+ {
+ write(1,s1,l1);
+ write(1," ",1);
+ write(1,s2,l2);
+ write(1,"\n",1);
+ }
+ return 0;
}
-?>
-Running...0:11.87 total, 9.74 user, 2.06 sys, 0 KB average size
-
+Compiling...
+real 0m0.205s
+user 0m0.172s
+sys 0m0.032s
+Running...
+real 0m28.001s
+user 0m6.400s
+sys 0m21.597s
+
+---------------------------------------------- C - g++ - std::cout
#include <iostream>
#define RUNS 10000000UL
}
return 0;
}
-Compiling...0:00.37 total, 0.34 user, 0.03 sys, 0 KB average size
-Running...0:08.07 total, 6.14 user, 1.92 sys, 0 KB average size
-
+Compiling...
+real 0m1.087s
+user 0m0.988s
+sys 0m0.100s
+Running...
+real 0m15.557s
+user 0m10.461s
+sys 0m5.096s
+
+------------------------------------------------------------- Perl
#!/usr/bin/perl
my $i=0;
{
print ("stuff1"," ","stuff2","\n");
}
-Running...0:05.66 total, 5.64 user, 0.01 sys, 0 KB average size
+Running...
+real 0m10.660s
+user 0m10.361s
+sys 0m0.028s
+------------------------------------------------- C - tcc - 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.05 user, 0.00 sys, 0 KB average size
-Running...0:02.85 total, 2.84 user, 0.00 sys, 0 KB average size
+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...0:00.10 total, 0.07 user, 0.02 sys, 0 KB average size
-Running...0:01.92 total, 1.92 user, 0.00 sys, 0 KB average size
-
+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
}
return 0;
}
-Compiling...0:00.08 total, 0.04 user, 0.02 sys, 0 KB average size
-Running...0:01.53 total, 1.50 user, 0.00 sys, 0 KB average size
+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>
+#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.199s
+user 0m0.164s
+sys 0m0.036s
+Running...
+real 0m5.027s
+user 0m4.996s
+sys 0m0.032s
+
+------------------------------------------------- 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.221s
+user 0m0.204s
+sys 0m0.016s
+Running...
+real 0m3.770s
+user 0m3.664s
+sys 0m0.028s
+
+----------------------------------------------- C<<1 - gcc - print
+#include "cll1.h"
+
+program
+{
+ repeat(10000000)
+ print("stuff1","stuff2");
+}
+Compiling...
+real 0m0.364s
+user 0m0.352s
+sys 0m0.012s
+Running...
+real 0m4.519s
+user 0m4.504s
+sys 0m0.016s
+
+-------------------------------------------------- C - gcc - 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.205s
+user 0m0.180s
+sys 0m0.024s
+Running...
+real 0m2.642s
+user 0m2.612s
+sys 0m0.032s