2814fb59 |
1 | AMD Athlon(tm) XP 1259.487 Mhz 2522.30 bogomips |
06ab91f0 |
2 | -------------------------------------------------- C - gcc - write |
67db9ef1 |
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 | } |
06ab91f0 |
23 | Compiling... |
2814fb59 |
24 | real 0m0.205s |
25 | user 0m0.172s |
26 | sys 0m0.032s |
06ab91f0 |
27 | Running... |
2814fb59 |
28 | real 0m28.001s |
29 | user 0m6.400s |
30 | sys 0m21.597s |
06ab91f0 |
31 | |
32 | ---------------------------------------------- C - g++ - std::cout |
d8394559 |
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 | } |
06ab91f0 |
44 | Compiling... |
2814fb59 |
45 | real 0m1.087s |
46 | user 0m0.988s |
47 | sys 0m0.100s |
06ab91f0 |
48 | Running... |
2814fb59 |
49 | real 0m15.557s |
50 | user 0m10.461s |
51 | sys 0m5.096s |
06ab91f0 |
52 | |
53 | ------------------------------------------------------------- Perl |
81088cec |
54 | #!/usr/bin/perl |
55 | |
56 | my $i=0; |
57 | for ($i=0;$i<10000000;$i++) |
58 | { |
59 | print ("stuff1"," ","stuff2","\n"); |
60 | } |
2814fb59 |
61 | Running... |
62 | real 0m10.660s |
63 | user 0m10.361s |
64 | sys 0m0.028s |
65 | |
66 | ------------------------------------------------- C - tcc - printf |
67 | #include <stdio.h> |
06ab91f0 |
68 | |
2814fb59 |
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 |
06ab91f0 |
81 | user 0m0.000s |
2814fb59 |
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 |
06ab91f0 |
154 | sys 0m0.004s |
2814fb59 |
155 | Running... |
156 | real 0m4.614s |
157 | user 0m4.596s |
158 | sys 0m0.020s |
81088cec |
159 | |
06ab91f0 |
160 | ------------------------------------------------- C - gcc - printf |
81088cec |
161 | #include <stdio.h> |
162 | |
163 | #define RUNS 10000000UL |
164 | int main (void) |
165 | { |
166 | unsigned long i; |
06ab91f0 |
167 | for (i=0;i<RUNS;i++) |
168 | { |
81088cec |
169 | printf("%s %s\n","stuff2","stuff2"); |
170 | } |
171 | return 0; |
172 | } |
06ab91f0 |
173 | Compiling... |
2814fb59 |
174 | real 0m0.199s |
175 | user 0m0.164s |
176 | sys 0m0.036s |
06ab91f0 |
177 | Running... |
2814fb59 |
178 | real 0m5.027s |
179 | user 0m4.996s |
180 | sys 0m0.032s |
06ab91f0 |
181 | |
182 | ------------------------------------------------- C - gcc - fwrite |
183 | #include <stdio.h> |
184 | #include <string.h> |
283bc497 |
185 | |
06ab91f0 |
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... |
2814fb59 |
205 | real 0m0.221s |
206 | user 0m0.204s |
06ab91f0 |
207 | sys 0m0.016s |
208 | Running... |
2814fb59 |
209 | real 0m3.770s |
210 | user 0m3.664s |
211 | sys 0m0.028s |
06ab91f0 |
212 | |
213 | ----------------------------------------------- C<<1 - gcc - print |
283bc497 |
214 | #include "cll1.h" |
215 | |
216 | program |
217 | { |
218 | repeat(10000000) |
219 | print("stuff1","stuff2"); |
220 | } |
06ab91f0 |
221 | Compiling... |
2814fb59 |
222 | real 0m0.364s |
223 | user 0m0.352s |
224 | sys 0m0.012s |
06ab91f0 |
225 | Running... |
2814fb59 |
226 | real 0m4.519s |
227 | user 0m4.504s |
228 | sys 0m0.016s |
06ab91f0 |
229 | |
230 | -------------------------------------------------- C - gcc - fputs |
81088cec |
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 | } |
06ab91f0 |
245 | Compiling... |
2814fb59 |
246 | real 0m0.205s |
247 | user 0m0.180s |
248 | sys 0m0.024s |
06ab91f0 |
249 | Running... |
2814fb59 |
250 | real 0m2.642s |
251 | user 0m2.612s |
252 | sys 0m0.032s |