+AMD Athlon(tm) XP 1259.392 Mhz 2520.58 bogomips
+------------------------------------------------------------- Ruby
#!/usr/bin/ruby
10000000.times { print "stuff1"," ","stuff2","\n" }
-Running...0:24.98 total, 23.33 user, 1.54 sys, 0 KB average size
+Running...
+real 0m50.940s
+user 0m49.107s
+sys 0m1.836s
+
+--------------------------------------------------- Python - range
#!/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
+Running...
+real 0m25.547s
+user 0m25.230s
+sys 0m0.320s
+-------------------------------------------------- Python - xrange
#!/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
+Running...
+real 0m26.269s
+user 0m26.254s
+sys 0m0.016s
+------------------------------------------------------------ PHP 5
#!/usr/bin/php5 -q
<?php
for ( $i=0; $i<10000000; $i++ )
echo "stuff1"." "."stuff2"."\n";
}
?>
-Running...0:11.87 total, 9.74 user, 2.06 sys, 0 KB average size
+Running...
+real 0m18.649s
+user 0m14.449s
+sys 0m4.200s
+
+-------------------------------------------------- C - gcc - write
+#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++)
+ {
+ write(1,s1,l1);
+ write(1," ",1);
+ write(1,s2,l2);
+ write(1,"\n",1);
+ }
+ return 0;
+}
+Compiling...
+real 0m0.188s
+user 0m0.164s
+sys 0m0.024s
+Running...
+real 0m21.353s
+user 0m7.572s
+sys 0m13.781s
+---------------------------------------------- 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 0m0.986s
+user 0m0.904s
+sys 0m0.080s
+Running...
+real 0m14.836s
+user 0m10.425s
+sys 0m4.416s
+------------------------------------------------------------- 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 0m14.115s
+user 0m13.005s
+sys 0m0.012s
+------------------------------------------------- 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.012s
+user 0m0.008s
+sys 0m0.004s
+Running...
+real 0m4.987s
+user 0m4.856s
+sys 0m0.032s
+
+------------------------------------------------- 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.017s
+user 0m0.012s
+sys 0m0.004s
+Running...
+real 0m3.678s
+user 0m3.672s
+sys 0m0.004s
+----------------------------------------------- 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.016s
+sys 0m0.004s
+Running...
+real 0m4.853s
+user 0m4.836s
+sys 0m0.016s
+-------------------------------------------------- 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.065s
+user 0m4.040s
+sys 0m0.024s
+
+------------------------------------------------- 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.180s
+user 0m0.152s
+sys 0m0.028s
+Running...
+real 0m4.877s
+user 0m4.860s
+sys 0m0.020s
+------------------------------------------------- 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.205s
+user 0m0.156s
+sys 0m0.048s
+Running...
+real 0m3.640s
+user 0m3.620s
+sys 0m0.020s
+
+----------------------------------------------- C<<1 - gcc - print
+#include "cll1.h"
+
+program
+{
+ repeat(10000000)
+ print("stuff1","stuff2");
+}
+Compiling...
+real 0m0.378s
+user 0m0.336s
+sys 0m0.040s
+Running...
+real 0m4.457s
+user 0m4.448s
+sys 0m0.012s
+
+-------------------------------------------------- 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.190s
+user 0m0.172s
+sys 0m0.020s
+Running...
+real 0m2.556s
+user 0m2.544s
+sys 0m0.012s