+AMD Athlon(tm) XP 1259.392 Mhz 2520.58 bogomips
+------------------------------------------------------------- Ruby
#!/usr/bin/ruby
10000000.times { print "stuff1"," ","stuff2","\n" }
-Running...0:25.02 total, 23.30 user, 1.58 sys
+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.46 total, 13.27 user, 0.18 sys
+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:12.92 total, 12.89 user, 0.01 sys
+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.38 total, 9.38 user, 2.00 sys
+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.36 total, 0.32 user, 0.04 sys
-Running...0:08.22 total, 6.07 user, 2.03 sys
+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.74 total, 5.73 user, 0.00 sys
+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.05 total, 0.02 user, 0.02 sys
-Running...0:02.85 total, 2.84 user, 0.01 sys
+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.09 total, 0.07 user, 0.02 sys
-Running...0:01.94 total, 1.92 user, 0.01 sys
+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.14 total, 0.04 user, 0.01 sys
-Running...0:01.56 total, 1.53 user, 0.01 sys
+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