| 1 | AMD Athlon(tm) XP 1259.487 Mhz 2522.30 bogomips |
| 2 | -------------------------------------------------- C - gcc - write |
| 3 | #include <string.h> |
| 4 | |
| 5 | #define RUNS 10000000UL |
| 6 | int main (void) |
| 7 | { |
| 8 | unsigned long i; |
| 9 | char *s1="stuff1"; |
| 10 | char *s2="stuff2"; |
| 11 | int l1=strlen(s1); |
| 12 | int l2=strlen(s2); |
| 13 | |
| 14 | for (i=0;i<RUNS;i++) |
| 15 | { |
| 16 | write(1,s1,l1); |
| 17 | write(1," ",1); |
| 18 | write(1,s2,l2); |
| 19 | write(1,"\n",1); |
| 20 | } |
| 21 | return 0; |
| 22 | } |
| 23 | Compiling... |
| 24 | real 0m0.205s |
| 25 | user 0m0.172s |
| 26 | sys 0m0.032s |
| 27 | Running... |
| 28 | real 0m28.001s |
| 29 | user 0m6.400s |
| 30 | sys 0m21.597s |
| 31 | |
| 32 | ---------------------------------------------- C - g++ - std::cout |
| 33 | #include <iostream> |
| 34 | |
| 35 | #define RUNS 10000000UL |
| 36 | int main() |
| 37 | { |
| 38 | unsigned long i; |
| 39 | for (i=0;i<RUNS;i++) { |
| 40 | std::cout << "stuff1" << " " << "stuff2" << std::endl; |
| 41 | } |
| 42 | return 0; |
| 43 | } |
| 44 | Compiling... |
| 45 | real 0m1.087s |
| 46 | user 0m0.988s |
| 47 | sys 0m0.100s |
| 48 | Running... |
| 49 | real 0m15.557s |
| 50 | user 0m10.461s |
| 51 | sys 0m5.096s |
| 52 | |
| 53 | ------------------------------------------------------------- Perl |
| 54 | #!/usr/bin/perl |
| 55 | |
| 56 | my $i=0; |
| 57 | for ($i=0;$i<10000000;$i++) |
| 58 | { |
| 59 | print ("stuff1"," ","stuff2","\n"); |
| 60 | } |
| 61 | Running... |
| 62 | real 0m10.660s |
| 63 | user 0m10.361s |
| 64 | sys 0m0.028s |
| 65 | |
| 66 | ------------------------------------------------- C - tcc - printf |
| 67 | #include <stdio.h> |
| 68 | |
| 69 | #define RUNS 10000000UL |
| 70 | int main (void) |
| 71 | { |
| 72 | unsigned long i; |
| 73 | for (i=0;i<RUNS;i++) |
| 74 | { |
| 75 | printf("%s %s\n","stuff2","stuff2"); |
| 76 | } |
| 77 | return 0; |
| 78 | } |
| 79 | Compiling... |
| 80 | real 0m0.013s |
| 81 | user 0m0.000s |
| 82 | sys 0m0.012s |
| 83 | Running... |
| 84 | real 0m5.387s |
| 85 | user 0m5.316s |
| 86 | sys 0m0.012s |
| 87 | |
| 88 | ------------------------------------------------- C - tcc - fwrite |
| 89 | #include <stdio.h> |
| 90 | #include <string.h> |
| 91 | |
| 92 | #define RUNS 10000000UL |
| 93 | int main (void) |
| 94 | { |
| 95 | unsigned long i; |
| 96 | char *s1="stuff1"; |
| 97 | char *s2="stuff2"; |
| 98 | int l1=strlen(s1); |
| 99 | int l2=strlen(s2); |
| 100 | |
| 101 | for (i=0;i<RUNS;i++) |
| 102 | { |
| 103 | fwrite(s1,l1,1,stdout); |
| 104 | fwrite(" ",1,1,stdout); |
| 105 | fwrite(s2,l2,1,stdout); |
| 106 | fwrite("\n",1,1,stdout); |
| 107 | } |
| 108 | return 0; |
| 109 | } |
| 110 | Compiling... |
| 111 | real 0m0.015s |
| 112 | user 0m0.008s |
| 113 | sys 0m0.008s |
| 114 | Running... |
| 115 | real 0m3.751s |
| 116 | user 0m3.708s |
| 117 | sys 0m0.012s |
| 118 | |
| 119 | ----------------------------------------------- C<<1 - tcc - print |
| 120 | #include "cll1.h" |
| 121 | |
| 122 | program |
| 123 | { |
| 124 | repeat(10000000) |
| 125 | print("stuff1","stuff2"); |
| 126 | } |
| 127 | Compiling... |
| 128 | real 0m0.022s |
| 129 | user 0m0.020s |
| 130 | sys 0m0.000s |
| 131 | Running... |
| 132 | real 0m4.780s |
| 133 | user 0m4.716s |
| 134 | sys 0m0.032s |
| 135 | |
| 136 | -------------------------------------------------- C - tcc - fputs |
| 137 | #include <stdio.h> |
| 138 | |
| 139 | #define RUNS 10000000UL |
| 140 | int main (void) |
| 141 | { |
| 142 | unsigned long i; |
| 143 | for (i=0;i<RUNS;i++) { |
| 144 | fputs("stuff1",stdout); |
| 145 | fputs(" ",stdout); |
| 146 | fputs("stuff2",stdout); |
| 147 | fputs("\n",stdout); |
| 148 | } |
| 149 | return 0; |
| 150 | } |
| 151 | Compiling... |
| 152 | real 0m0.012s |
| 153 | user 0m0.008s |
| 154 | sys 0m0.004s |
| 155 | Running... |
| 156 | real 0m4.614s |
| 157 | user 0m4.596s |
| 158 | sys 0m0.020s |
| 159 | |
| 160 | ------------------------------------------------- C - gcc - printf |
| 161 | #include <stdio.h> |
| 162 | |
| 163 | #define RUNS 10000000UL |
| 164 | int main (void) |
| 165 | { |
| 166 | unsigned long i; |
| 167 | for (i=0;i<RUNS;i++) |
| 168 | { |
| 169 | printf("%s %s\n","stuff2","stuff2"); |
| 170 | } |
| 171 | return 0; |
| 172 | } |
| 173 | Compiling... |
| 174 | real 0m0.199s |
| 175 | user 0m0.164s |
| 176 | sys 0m0.036s |
| 177 | Running... |
| 178 | real 0m5.027s |
| 179 | user 0m4.996s |
| 180 | sys 0m0.032s |
| 181 | |
| 182 | ------------------------------------------------- C - gcc - fwrite |
| 183 | #include <stdio.h> |
| 184 | #include <string.h> |
| 185 | |
| 186 | #define RUNS 10000000UL |
| 187 | int main (void) |
| 188 | { |
| 189 | unsigned long i; |
| 190 | char *s1="stuff1"; |
| 191 | char *s2="stuff2"; |
| 192 | int l1=strlen(s1); |
| 193 | int l2=strlen(s2); |
| 194 | |
| 195 | for (i=0;i<RUNS;i++) |
| 196 | { |
| 197 | fwrite(s1,l1,1,stdout); |
| 198 | fwrite(" ",1,1,stdout); |
| 199 | fwrite(s2,l2,1,stdout); |
| 200 | fwrite("\n",1,1,stdout); |
| 201 | } |
| 202 | return 0; |
| 203 | } |
| 204 | Compiling... |
| 205 | real 0m0.221s |
| 206 | user 0m0.204s |
| 207 | sys 0m0.016s |
| 208 | Running... |
| 209 | real 0m3.770s |
| 210 | user 0m3.664s |
| 211 | sys 0m0.028s |
| 212 | |
| 213 | ----------------------------------------------- C<<1 - gcc - print |
| 214 | #include "cll1.h" |
| 215 | |
| 216 | program |
| 217 | { |
| 218 | repeat(10000000) |
| 219 | print("stuff1","stuff2"); |
| 220 | } |
| 221 | Compiling... |
| 222 | real 0m0.364s |
| 223 | user 0m0.352s |
| 224 | sys 0m0.012s |
| 225 | Running... |
| 226 | real 0m4.519s |
| 227 | user 0m4.504s |
| 228 | sys 0m0.016s |
| 229 | |
| 230 | -------------------------------------------------- C - gcc - fputs |
| 231 | #include <stdio.h> |
| 232 | |
| 233 | #define RUNS 10000000UL |
| 234 | int main (void) |
| 235 | { |
| 236 | unsigned long i; |
| 237 | for (i=0;i<RUNS;i++) { |
| 238 | fputs("stuff1",stdout); |
| 239 | fputs(" ",stdout); |
| 240 | fputs("stuff2",stdout); |
| 241 | fputs("\n",stdout); |
| 242 | } |
| 243 | return 0; |
| 244 | } |
| 245 | Compiling... |
| 246 | real 0m0.205s |
| 247 | user 0m0.180s |
| 248 | sys 0m0.024s |
| 249 | Running... |
| 250 | real 0m2.642s |
| 251 | user 0m2.612s |
| 252 | sys 0m0.032s |