changeset 1 | 2fb8b9db1c86 |
0:ffa851df0825 | 1:2fb8b9db1c86 |
---|---|
1 from pybench import Test |
|
2 |
|
3 class SpecialClassAttribute(Test): |
|
4 |
|
5 version = 2.0 |
|
6 operations = 5*(12 + 12) |
|
7 rounds = 100000 |
|
8 |
|
9 def test(self): |
|
10 |
|
11 class c: |
|
12 pass |
|
13 |
|
14 for i in xrange(self.rounds): |
|
15 |
|
16 c.__a = 2 |
|
17 c.__b = 3 |
|
18 c.__c = 4 |
|
19 |
|
20 c.__a = 2 |
|
21 c.__b = 3 |
|
22 c.__c = 4 |
|
23 |
|
24 c.__a = 2 |
|
25 c.__b = 3 |
|
26 c.__c = 4 |
|
27 |
|
28 c.__a = 2 |
|
29 c.__b = 3 |
|
30 c.__c = 4 |
|
31 |
|
32 x = c.__a |
|
33 x = c.__b |
|
34 x = c.__c |
|
35 |
|
36 x = c.__a |
|
37 x = c.__b |
|
38 x = c.__c |
|
39 |
|
40 x = c.__a |
|
41 x = c.__b |
|
42 x = c.__c |
|
43 |
|
44 x = c.__a |
|
45 x = c.__b |
|
46 x = c.__c |
|
47 |
|
48 c.__a = 2 |
|
49 c.__b = 3 |
|
50 c.__c = 4 |
|
51 |
|
52 c.__a = 2 |
|
53 c.__b = 3 |
|
54 c.__c = 4 |
|
55 |
|
56 c.__a = 2 |
|
57 c.__b = 3 |
|
58 c.__c = 4 |
|
59 |
|
60 c.__a = 2 |
|
61 c.__b = 3 |
|
62 c.__c = 4 |
|
63 |
|
64 x = c.__a |
|
65 x = c.__b |
|
66 x = c.__c |
|
67 |
|
68 x = c.__a |
|
69 x = c.__b |
|
70 x = c.__c |
|
71 |
|
72 x = c.__a |
|
73 x = c.__b |
|
74 x = c.__c |
|
75 |
|
76 x = c.__a |
|
77 x = c.__b |
|
78 x = c.__c |
|
79 |
|
80 c.__a = 2 |
|
81 c.__b = 3 |
|
82 c.__c = 4 |
|
83 |
|
84 c.__a = 2 |
|
85 c.__b = 3 |
|
86 c.__c = 4 |
|
87 |
|
88 c.__a = 2 |
|
89 c.__b = 3 |
|
90 c.__c = 4 |
|
91 |
|
92 c.__a = 2 |
|
93 c.__b = 3 |
|
94 c.__c = 4 |
|
95 |
|
96 x = c.__a |
|
97 x = c.__b |
|
98 x = c.__c |
|
99 |
|
100 x = c.__a |
|
101 x = c.__b |
|
102 x = c.__c |
|
103 |
|
104 x = c.__a |
|
105 x = c.__b |
|
106 x = c.__c |
|
107 |
|
108 x = c.__a |
|
109 x = c.__b |
|
110 x = c.__c |
|
111 |
|
112 c.__a = 2 |
|
113 c.__b = 3 |
|
114 c.__c = 4 |
|
115 |
|
116 c.__a = 2 |
|
117 c.__b = 3 |
|
118 c.__c = 4 |
|
119 |
|
120 c.__a = 2 |
|
121 c.__b = 3 |
|
122 c.__c = 4 |
|
123 |
|
124 c.__a = 2 |
|
125 c.__b = 3 |
|
126 c.__c = 4 |
|
127 |
|
128 x = c.__a |
|
129 x = c.__b |
|
130 x = c.__c |
|
131 |
|
132 x = c.__a |
|
133 x = c.__b |
|
134 x = c.__c |
|
135 |
|
136 x = c.__a |
|
137 x = c.__b |
|
138 x = c.__c |
|
139 |
|
140 x = c.__a |
|
141 x = c.__b |
|
142 x = c.__c |
|
143 |
|
144 c.__a = 2 |
|
145 c.__b = 3 |
|
146 c.__c = 4 |
|
147 |
|
148 c.__a = 2 |
|
149 c.__b = 3 |
|
150 c.__c = 4 |
|
151 |
|
152 c.__a = 2 |
|
153 c.__b = 3 |
|
154 c.__c = 4 |
|
155 |
|
156 c.__a = 2 |
|
157 c.__b = 3 |
|
158 c.__c = 4 |
|
159 |
|
160 x = c.__a |
|
161 x = c.__b |
|
162 x = c.__c |
|
163 |
|
164 x = c.__a |
|
165 x = c.__b |
|
166 x = c.__c |
|
167 |
|
168 x = c.__a |
|
169 x = c.__b |
|
170 x = c.__c |
|
171 |
|
172 x = c.__a |
|
173 x = c.__b |
|
174 x = c.__c |
|
175 |
|
176 def calibrate(self): |
|
177 |
|
178 class c: |
|
179 pass |
|
180 |
|
181 for i in xrange(self.rounds): |
|
182 pass |
|
183 |
|
184 class NormalClassAttribute(Test): |
|
185 |
|
186 version = 2.0 |
|
187 operations = 5*(12 + 12) |
|
188 rounds = 100000 |
|
189 |
|
190 def test(self): |
|
191 |
|
192 class c: |
|
193 pass |
|
194 |
|
195 for i in xrange(self.rounds): |
|
196 |
|
197 c.a = 2 |
|
198 c.b = 3 |
|
199 c.c = 4 |
|
200 |
|
201 c.a = 2 |
|
202 c.b = 3 |
|
203 c.c = 4 |
|
204 |
|
205 c.a = 2 |
|
206 c.b = 3 |
|
207 c.c = 4 |
|
208 |
|
209 c.a = 2 |
|
210 c.b = 3 |
|
211 c.c = 4 |
|
212 |
|
213 |
|
214 x = c.a |
|
215 x = c.b |
|
216 x = c.c |
|
217 |
|
218 x = c.a |
|
219 x = c.b |
|
220 x = c.c |
|
221 |
|
222 x = c.a |
|
223 x = c.b |
|
224 x = c.c |
|
225 |
|
226 x = c.a |
|
227 x = c.b |
|
228 x = c.c |
|
229 |
|
230 c.a = 2 |
|
231 c.b = 3 |
|
232 c.c = 4 |
|
233 |
|
234 c.a = 2 |
|
235 c.b = 3 |
|
236 c.c = 4 |
|
237 |
|
238 c.a = 2 |
|
239 c.b = 3 |
|
240 c.c = 4 |
|
241 |
|
242 c.a = 2 |
|
243 c.b = 3 |
|
244 c.c = 4 |
|
245 |
|
246 |
|
247 x = c.a |
|
248 x = c.b |
|
249 x = c.c |
|
250 |
|
251 x = c.a |
|
252 x = c.b |
|
253 x = c.c |
|
254 |
|
255 x = c.a |
|
256 x = c.b |
|
257 x = c.c |
|
258 |
|
259 x = c.a |
|
260 x = c.b |
|
261 x = c.c |
|
262 |
|
263 c.a = 2 |
|
264 c.b = 3 |
|
265 c.c = 4 |
|
266 |
|
267 c.a = 2 |
|
268 c.b = 3 |
|
269 c.c = 4 |
|
270 |
|
271 c.a = 2 |
|
272 c.b = 3 |
|
273 c.c = 4 |
|
274 |
|
275 c.a = 2 |
|
276 c.b = 3 |
|
277 c.c = 4 |
|
278 |
|
279 |
|
280 x = c.a |
|
281 x = c.b |
|
282 x = c.c |
|
283 |
|
284 x = c.a |
|
285 x = c.b |
|
286 x = c.c |
|
287 |
|
288 x = c.a |
|
289 x = c.b |
|
290 x = c.c |
|
291 |
|
292 x = c.a |
|
293 x = c.b |
|
294 x = c.c |
|
295 |
|
296 c.a = 2 |
|
297 c.b = 3 |
|
298 c.c = 4 |
|
299 |
|
300 c.a = 2 |
|
301 c.b = 3 |
|
302 c.c = 4 |
|
303 |
|
304 c.a = 2 |
|
305 c.b = 3 |
|
306 c.c = 4 |
|
307 |
|
308 c.a = 2 |
|
309 c.b = 3 |
|
310 c.c = 4 |
|
311 |
|
312 |
|
313 x = c.a |
|
314 x = c.b |
|
315 x = c.c |
|
316 |
|
317 x = c.a |
|
318 x = c.b |
|
319 x = c.c |
|
320 |
|
321 x = c.a |
|
322 x = c.b |
|
323 x = c.c |
|
324 |
|
325 x = c.a |
|
326 x = c.b |
|
327 x = c.c |
|
328 |
|
329 c.a = 2 |
|
330 c.b = 3 |
|
331 c.c = 4 |
|
332 |
|
333 c.a = 2 |
|
334 c.b = 3 |
|
335 c.c = 4 |
|
336 |
|
337 c.a = 2 |
|
338 c.b = 3 |
|
339 c.c = 4 |
|
340 |
|
341 c.a = 2 |
|
342 c.b = 3 |
|
343 c.c = 4 |
|
344 |
|
345 |
|
346 x = c.a |
|
347 x = c.b |
|
348 x = c.c |
|
349 |
|
350 x = c.a |
|
351 x = c.b |
|
352 x = c.c |
|
353 |
|
354 x = c.a |
|
355 x = c.b |
|
356 x = c.c |
|
357 |
|
358 x = c.a |
|
359 x = c.b |
|
360 x = c.c |
|
361 |
|
362 def calibrate(self): |
|
363 |
|
364 class c: |
|
365 pass |
|
366 |
|
367 for i in xrange(self.rounds): |
|
368 pass |
|
369 |
|
370 class SpecialInstanceAttribute(Test): |
|
371 |
|
372 version = 2.0 |
|
373 operations = 5*(12 + 12) |
|
374 rounds = 100000 |
|
375 |
|
376 def test(self): |
|
377 |
|
378 class c: |
|
379 pass |
|
380 o = c() |
|
381 |
|
382 for i in xrange(self.rounds): |
|
383 |
|
384 o.__a__ = 2 |
|
385 o.__b__ = 3 |
|
386 o.__c__ = 4 |
|
387 |
|
388 o.__a__ = 2 |
|
389 o.__b__ = 3 |
|
390 o.__c__ = 4 |
|
391 |
|
392 o.__a__ = 2 |
|
393 o.__b__ = 3 |
|
394 o.__c__ = 4 |
|
395 |
|
396 o.__a__ = 2 |
|
397 o.__b__ = 3 |
|
398 o.__c__ = 4 |
|
399 |
|
400 |
|
401 x = o.__a__ |
|
402 x = o.__b__ |
|
403 x = o.__c__ |
|
404 |
|
405 x = o.__a__ |
|
406 x = o.__b__ |
|
407 x = o.__c__ |
|
408 |
|
409 x = o.__a__ |
|
410 x = o.__b__ |
|
411 x = o.__c__ |
|
412 |
|
413 x = o.__a__ |
|
414 x = o.__b__ |
|
415 x = o.__c__ |
|
416 |
|
417 o.__a__ = 2 |
|
418 o.__b__ = 3 |
|
419 o.__c__ = 4 |
|
420 |
|
421 o.__a__ = 2 |
|
422 o.__b__ = 3 |
|
423 o.__c__ = 4 |
|
424 |
|
425 o.__a__ = 2 |
|
426 o.__b__ = 3 |
|
427 o.__c__ = 4 |
|
428 |
|
429 o.__a__ = 2 |
|
430 o.__b__ = 3 |
|
431 o.__c__ = 4 |
|
432 |
|
433 |
|
434 x = o.__a__ |
|
435 x = o.__b__ |
|
436 x = o.__c__ |
|
437 |
|
438 x = o.__a__ |
|
439 x = o.__b__ |
|
440 x = o.__c__ |
|
441 |
|
442 x = o.__a__ |
|
443 x = o.__b__ |
|
444 x = o.__c__ |
|
445 |
|
446 x = o.__a__ |
|
447 x = o.__b__ |
|
448 x = o.__c__ |
|
449 |
|
450 o.__a__ = 2 |
|
451 o.__b__ = 3 |
|
452 o.__c__ = 4 |
|
453 |
|
454 o.__a__ = 2 |
|
455 o.__b__ = 3 |
|
456 o.__c__ = 4 |
|
457 |
|
458 o.__a__ = 2 |
|
459 o.__b__ = 3 |
|
460 o.__c__ = 4 |
|
461 |
|
462 o.__a__ = 2 |
|
463 o.__b__ = 3 |
|
464 o.__c__ = 4 |
|
465 |
|
466 |
|
467 x = o.__a__ |
|
468 x = o.__b__ |
|
469 x = o.__c__ |
|
470 |
|
471 x = o.__a__ |
|
472 x = o.__b__ |
|
473 x = o.__c__ |
|
474 |
|
475 x = o.__a__ |
|
476 x = o.__b__ |
|
477 x = o.__c__ |
|
478 |
|
479 x = o.__a__ |
|
480 x = o.__b__ |
|
481 x = o.__c__ |
|
482 |
|
483 o.__a__ = 2 |
|
484 o.__b__ = 3 |
|
485 o.__c__ = 4 |
|
486 |
|
487 o.__a__ = 2 |
|
488 o.__b__ = 3 |
|
489 o.__c__ = 4 |
|
490 |
|
491 o.__a__ = 2 |
|
492 o.__b__ = 3 |
|
493 o.__c__ = 4 |
|
494 |
|
495 o.__a__ = 2 |
|
496 o.__b__ = 3 |
|
497 o.__c__ = 4 |
|
498 |
|
499 |
|
500 x = o.__a__ |
|
501 x = o.__b__ |
|
502 x = o.__c__ |
|
503 |
|
504 x = o.__a__ |
|
505 x = o.__b__ |
|
506 x = o.__c__ |
|
507 |
|
508 x = o.__a__ |
|
509 x = o.__b__ |
|
510 x = o.__c__ |
|
511 |
|
512 x = o.__a__ |
|
513 x = o.__b__ |
|
514 x = o.__c__ |
|
515 |
|
516 o.__a__ = 2 |
|
517 o.__b__ = 3 |
|
518 o.__c__ = 4 |
|
519 |
|
520 o.__a__ = 2 |
|
521 o.__b__ = 3 |
|
522 o.__c__ = 4 |
|
523 |
|
524 o.__a__ = 2 |
|
525 o.__b__ = 3 |
|
526 o.__c__ = 4 |
|
527 |
|
528 o.__a__ = 2 |
|
529 o.__b__ = 3 |
|
530 o.__c__ = 4 |
|
531 |
|
532 |
|
533 x = o.__a__ |
|
534 x = o.__b__ |
|
535 x = o.__c__ |
|
536 |
|
537 x = o.__a__ |
|
538 x = o.__b__ |
|
539 x = o.__c__ |
|
540 |
|
541 x = o.__a__ |
|
542 x = o.__b__ |
|
543 x = o.__c__ |
|
544 |
|
545 x = o.__a__ |
|
546 x = o.__b__ |
|
547 x = o.__c__ |
|
548 |
|
549 def calibrate(self): |
|
550 |
|
551 class c: |
|
552 pass |
|
553 o = c() |
|
554 |
|
555 for i in xrange(self.rounds): |
|
556 pass |
|
557 |
|
558 class NormalInstanceAttribute(Test): |
|
559 |
|
560 version = 2.0 |
|
561 operations = 5*(12 + 12) |
|
562 rounds = 100000 |
|
563 |
|
564 def test(self): |
|
565 |
|
566 class c: |
|
567 pass |
|
568 o = c() |
|
569 |
|
570 for i in xrange(self.rounds): |
|
571 |
|
572 o.a = 2 |
|
573 o.b = 3 |
|
574 o.c = 4 |
|
575 |
|
576 o.a = 2 |
|
577 o.b = 3 |
|
578 o.c = 4 |
|
579 |
|
580 o.a = 2 |
|
581 o.b = 3 |
|
582 o.c = 4 |
|
583 |
|
584 o.a = 2 |
|
585 o.b = 3 |
|
586 o.c = 4 |
|
587 |
|
588 |
|
589 x = o.a |
|
590 x = o.b |
|
591 x = o.c |
|
592 |
|
593 x = o.a |
|
594 x = o.b |
|
595 x = o.c |
|
596 |
|
597 x = o.a |
|
598 x = o.b |
|
599 x = o.c |
|
600 |
|
601 x = o.a |
|
602 x = o.b |
|
603 x = o.c |
|
604 |
|
605 o.a = 2 |
|
606 o.b = 3 |
|
607 o.c = 4 |
|
608 |
|
609 o.a = 2 |
|
610 o.b = 3 |
|
611 o.c = 4 |
|
612 |
|
613 o.a = 2 |
|
614 o.b = 3 |
|
615 o.c = 4 |
|
616 |
|
617 o.a = 2 |
|
618 o.b = 3 |
|
619 o.c = 4 |
|
620 |
|
621 |
|
622 x = o.a |
|
623 x = o.b |
|
624 x = o.c |
|
625 |
|
626 x = o.a |
|
627 x = o.b |
|
628 x = o.c |
|
629 |
|
630 x = o.a |
|
631 x = o.b |
|
632 x = o.c |
|
633 |
|
634 x = o.a |
|
635 x = o.b |
|
636 x = o.c |
|
637 |
|
638 o.a = 2 |
|
639 o.b = 3 |
|
640 o.c = 4 |
|
641 |
|
642 o.a = 2 |
|
643 o.b = 3 |
|
644 o.c = 4 |
|
645 |
|
646 o.a = 2 |
|
647 o.b = 3 |
|
648 o.c = 4 |
|
649 |
|
650 o.a = 2 |
|
651 o.b = 3 |
|
652 o.c = 4 |
|
653 |
|
654 |
|
655 x = o.a |
|
656 x = o.b |
|
657 x = o.c |
|
658 |
|
659 x = o.a |
|
660 x = o.b |
|
661 x = o.c |
|
662 |
|
663 x = o.a |
|
664 x = o.b |
|
665 x = o.c |
|
666 |
|
667 x = o.a |
|
668 x = o.b |
|
669 x = o.c |
|
670 |
|
671 o.a = 2 |
|
672 o.b = 3 |
|
673 o.c = 4 |
|
674 |
|
675 o.a = 2 |
|
676 o.b = 3 |
|
677 o.c = 4 |
|
678 |
|
679 o.a = 2 |
|
680 o.b = 3 |
|
681 o.c = 4 |
|
682 |
|
683 o.a = 2 |
|
684 o.b = 3 |
|
685 o.c = 4 |
|
686 |
|
687 |
|
688 x = o.a |
|
689 x = o.b |
|
690 x = o.c |
|
691 |
|
692 x = o.a |
|
693 x = o.b |
|
694 x = o.c |
|
695 |
|
696 x = o.a |
|
697 x = o.b |
|
698 x = o.c |
|
699 |
|
700 x = o.a |
|
701 x = o.b |
|
702 x = o.c |
|
703 |
|
704 o.a = 2 |
|
705 o.b = 3 |
|
706 o.c = 4 |
|
707 |
|
708 o.a = 2 |
|
709 o.b = 3 |
|
710 o.c = 4 |
|
711 |
|
712 o.a = 2 |
|
713 o.b = 3 |
|
714 o.c = 4 |
|
715 |
|
716 o.a = 2 |
|
717 o.b = 3 |
|
718 o.c = 4 |
|
719 |
|
720 |
|
721 x = o.a |
|
722 x = o.b |
|
723 x = o.c |
|
724 |
|
725 x = o.a |
|
726 x = o.b |
|
727 x = o.c |
|
728 |
|
729 x = o.a |
|
730 x = o.b |
|
731 x = o.c |
|
732 |
|
733 x = o.a |
|
734 x = o.b |
|
735 x = o.c |
|
736 |
|
737 def calibrate(self): |
|
738 |
|
739 class c: |
|
740 pass |
|
741 o = c() |
|
742 |
|
743 for i in xrange(self.rounds): |
|
744 pass |
|
745 |
|
746 class BuiltinMethodLookup(Test): |
|
747 |
|
748 version = 2.0 |
|
749 operations = 5*(3*5 + 3*5) |
|
750 rounds = 70000 |
|
751 |
|
752 def test(self): |
|
753 |
|
754 l = [] |
|
755 d = {} |
|
756 |
|
757 for i in xrange(self.rounds): |
|
758 |
|
759 l.append |
|
760 l.append |
|
761 l.append |
|
762 l.append |
|
763 l.append |
|
764 |
|
765 l.insert |
|
766 l.insert |
|
767 l.insert |
|
768 l.insert |
|
769 l.insert |
|
770 |
|
771 l.sort |
|
772 l.sort |
|
773 l.sort |
|
774 l.sort |
|
775 l.sort |
|
776 |
|
777 d.has_key |
|
778 d.has_key |
|
779 d.has_key |
|
780 d.has_key |
|
781 d.has_key |
|
782 |
|
783 d.items |
|
784 d.items |
|
785 d.items |
|
786 d.items |
|
787 d.items |
|
788 |
|
789 d.get |
|
790 d.get |
|
791 d.get |
|
792 d.get |
|
793 d.get |
|
794 |
|
795 l.append |
|
796 l.append |
|
797 l.append |
|
798 l.append |
|
799 l.append |
|
800 |
|
801 l.insert |
|
802 l.insert |
|
803 l.insert |
|
804 l.insert |
|
805 l.insert |
|
806 |
|
807 l.sort |
|
808 l.sort |
|
809 l.sort |
|
810 l.sort |
|
811 l.sort |
|
812 |
|
813 d.has_key |
|
814 d.has_key |
|
815 d.has_key |
|
816 d.has_key |
|
817 d.has_key |
|
818 |
|
819 d.items |
|
820 d.items |
|
821 d.items |
|
822 d.items |
|
823 d.items |
|
824 |
|
825 d.get |
|
826 d.get |
|
827 d.get |
|
828 d.get |
|
829 d.get |
|
830 |
|
831 l.append |
|
832 l.append |
|
833 l.append |
|
834 l.append |
|
835 l.append |
|
836 |
|
837 l.insert |
|
838 l.insert |
|
839 l.insert |
|
840 l.insert |
|
841 l.insert |
|
842 |
|
843 l.sort |
|
844 l.sort |
|
845 l.sort |
|
846 l.sort |
|
847 l.sort |
|
848 |
|
849 d.has_key |
|
850 d.has_key |
|
851 d.has_key |
|
852 d.has_key |
|
853 d.has_key |
|
854 |
|
855 d.items |
|
856 d.items |
|
857 d.items |
|
858 d.items |
|
859 d.items |
|
860 |
|
861 d.get |
|
862 d.get |
|
863 d.get |
|
864 d.get |
|
865 d.get |
|
866 |
|
867 l.append |
|
868 l.append |
|
869 l.append |
|
870 l.append |
|
871 l.append |
|
872 |
|
873 l.insert |
|
874 l.insert |
|
875 l.insert |
|
876 l.insert |
|
877 l.insert |
|
878 |
|
879 l.sort |
|
880 l.sort |
|
881 l.sort |
|
882 l.sort |
|
883 l.sort |
|
884 |
|
885 d.has_key |
|
886 d.has_key |
|
887 d.has_key |
|
888 d.has_key |
|
889 d.has_key |
|
890 |
|
891 d.items |
|
892 d.items |
|
893 d.items |
|
894 d.items |
|
895 d.items |
|
896 |
|
897 d.get |
|
898 d.get |
|
899 d.get |
|
900 d.get |
|
901 d.get |
|
902 |
|
903 l.append |
|
904 l.append |
|
905 l.append |
|
906 l.append |
|
907 l.append |
|
908 |
|
909 l.insert |
|
910 l.insert |
|
911 l.insert |
|
912 l.insert |
|
913 l.insert |
|
914 |
|
915 l.sort |
|
916 l.sort |
|
917 l.sort |
|
918 l.sort |
|
919 l.sort |
|
920 |
|
921 d.has_key |
|
922 d.has_key |
|
923 d.has_key |
|
924 d.has_key |
|
925 d.has_key |
|
926 |
|
927 d.items |
|
928 d.items |
|
929 d.items |
|
930 d.items |
|
931 d.items |
|
932 |
|
933 d.get |
|
934 d.get |
|
935 d.get |
|
936 d.get |
|
937 d.get |
|
938 |
|
939 def calibrate(self): |
|
940 |
|
941 l = [] |
|
942 d = {} |
|
943 |
|
944 for i in xrange(self.rounds): |
|
945 pass |