+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 1m50.369s
+user 1m0.120s
+sys 0m2.332s
+
+--------------------------------------------------- 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 0m54.919s
+user 0m30.274s
+sys 0m0.564s
+-------------------------------------------------- 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 0m50.106s
+user 0m27.758s
+sys 0m0.136s
+------------------------------------------------------------ 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 0m34.079s
+user 0m16.805s
+sys 0m4.916s
+
+-------------------------------------------------- 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.494s
+user 0m0.196s
+sys 0m0.036s
+Running...
+real 1m8.226s
+user 0m7.984s
+sys 0m19.985s
+---------------------------------------------- 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 0m8.042s
+user 0m1.176s
+sys 0m0.132s
+Running...
+real 0m33.827s
+user 0m11.369s
+sys 0m3.908s
+------------------------------------------------------------- Perl
#!/usr/bin/perl
my $i=0;
{
print ("stuff1"," ","stuff2","\n");
}
-Running...0:05.74 total, 5.73 user, 0.00 sys
+Running...
+real 0m29.584s
+user 0m14.577s
+sys 0m0.088s
+------------------------------------------------- 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.014s
+user 0m0.004s
+sys 0m0.008s
+Running...
+real 0m11.628s
+user 0m5.564s
+sys 0m0.064s
+
+------------------------------------------------- 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.004s
+sys 0m0.004s
+Running...
+real 0m8.379s
+user 0m4.004s
+sys 0m0.036s
+----------------------------------------------- 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.029s
+user 0m0.024s
+sys 0m0.000s
+Running...
+real 0m16.690s
+user 0m6.224s
+sys 0m0.040s
+-------------------------------------------------- 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.016s
+user 0m0.008s
+sys 0m0.008s
+Running...
+real 0m8.072s
+user 0m4.608s
+sys 0m0.068s
+
+------------------------------------------------- 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.249s
+user 0m0.196s
+sys 0m0.028s
+Running...
+real 0m7.017s
+user 0m5.368s
+sys 0m0.028s
+------------------------------------------------- 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.417s
+user 0m0.216s
+sys 0m0.024s
+Running...
+real 0m5.814s
+user 0m3.960s
+sys 0m0.032s
+
+----------------------------------------------- C<<1 - gcc - print
+#include "cll1.h"
+
+program
+{
+ repeat(10000000)
+ print("stuff1","stuff2");
+}
+Compiling...
+real 0m0.579s
+user 0m0.412s
+sys 0m0.056s
+Running...
+real 0m6.531s
+user 0m4.896s
+sys 0m0.052s
+
+-------------------------------------------------- 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.261s
+user 0m0.200s
+sys 0m0.040s
+Running...
+real 0m3.596s
+user 0m2.784s
+sys 0m0.028s