1from pybench import Test 2 3class CompareIntegers(Test): 4 5 version = 2.0 6 operations = 30 * 5 7 rounds = 120000 8 9 def test(self): 10 11 for i in xrange(self.rounds): 12 13 2 < 3 14 2 > 3 15 2 == 3 16 2 > 3 17 2 < 3 18 19 2 < 3 20 2 > 3 21 2 == 3 22 2 > 3 23 2 < 3 24 25 2 < 3 26 2 > 3 27 2 == 3 28 2 > 3 29 2 < 3 30 31 2 < 3 32 2 > 3 33 2 == 3 34 2 > 3 35 2 < 3 36 37 2 < 3 38 2 > 3 39 2 == 3 40 2 > 3 41 2 < 3 42 43 2 < 3 44 2 > 3 45 2 == 3 46 2 > 3 47 2 < 3 48 49 2 < 3 50 2 > 3 51 2 == 3 52 2 > 3 53 2 < 3 54 55 2 < 3 56 2 > 3 57 2 == 3 58 2 > 3 59 2 < 3 60 61 2 < 3 62 2 > 3 63 2 == 3 64 2 > 3 65 2 < 3 66 67 2 < 3 68 2 > 3 69 2 == 3 70 2 > 3 71 2 < 3 72 73 2 < 3 74 2 > 3 75 2 == 3 76 2 > 3 77 2 < 3 78 79 2 < 3 80 2 > 3 81 2 == 3 82 2 > 3 83 2 < 3 84 85 2 < 3 86 2 > 3 87 2 == 3 88 2 > 3 89 2 < 3 90 91 2 < 3 92 2 > 3 93 2 == 3 94 2 > 3 95 2 < 3 96 97 2 < 3 98 2 > 3 99 2 == 3 100 2 > 3 101 2 < 3 102 103 2 < 3 104 2 > 3 105 2 == 3 106 2 > 3 107 2 < 3 108 109 2 < 3 110 2 > 3 111 2 == 3 112 2 > 3 113 2 < 3 114 115 2 < 3 116 2 > 3 117 2 == 3 118 2 > 3 119 2 < 3 120 121 2 < 3 122 2 > 3 123 2 == 3 124 2 > 3 125 2 < 3 126 127 2 < 3 128 2 > 3 129 2 == 3 130 2 > 3 131 2 < 3 132 133 2 < 3 134 2 > 3 135 2 == 3 136 2 > 3 137 2 < 3 138 139 2 < 3 140 2 > 3 141 2 == 3 142 2 > 3 143 2 < 3 144 145 2 < 3 146 2 > 3 147 2 == 3 148 2 > 3 149 2 < 3 150 151 2 < 3 152 2 > 3 153 2 == 3 154 2 > 3 155 2 < 3 156 157 2 < 3 158 2 > 3 159 2 == 3 160 2 > 3 161 2 < 3 162 163 2 < 3 164 2 > 3 165 2 == 3 166 2 > 3 167 2 < 3 168 169 2 < 3 170 2 > 3 171 2 == 3 172 2 > 3 173 2 < 3 174 175 2 < 3 176 2 > 3 177 2 == 3 178 2 > 3 179 2 < 3 180 181 2 < 3 182 2 > 3 183 2 == 3 184 2 > 3 185 2 < 3 186 187 2 < 3 188 2 > 3 189 2 == 3 190 2 > 3 191 2 < 3 192 193 def calibrate(self): 194 195 for i in xrange(self.rounds): 196 pass 197 198 199class CompareFloats(Test): 200 201 version = 2.0 202 operations = 30 * 5 203 rounds = 80000 204 205 def test(self): 206 207 for i in xrange(self.rounds): 208 209 2.1 < 3.31 210 2.1 > 3.31 211 2.1 == 3.31 212 2.1 > 3.31 213 2.1 < 3.31 214 215 2.1 < 3.31 216 2.1 > 3.31 217 2.1 == 3.31 218 2.1 > 3.31 219 2.1 < 3.31 220 221 2.1 < 3.31 222 2.1 > 3.31 223 2.1 == 3.31 224 2.1 > 3.31 225 2.1 < 3.31 226 227 2.1 < 3.31 228 2.1 > 3.31 229 2.1 == 3.31 230 2.1 > 3.31 231 2.1 < 3.31 232 233 2.1 < 3.31 234 2.1 > 3.31 235 2.1 == 3.31 236 2.1 > 3.31 237 2.1 < 3.31 238 239 2.1 < 3.31 240 2.1 > 3.31 241 2.1 == 3.31 242 2.1 > 3.31 243 2.1 < 3.31 244 245 2.1 < 3.31 246 2.1 > 3.31 247 2.1 == 3.31 248 2.1 > 3.31 249 2.1 < 3.31 250 251 2.1 < 3.31 252 2.1 > 3.31 253 2.1 == 3.31 254 2.1 > 3.31 255 2.1 < 3.31 256 257 2.1 < 3.31 258 2.1 > 3.31 259 2.1 == 3.31 260 2.1 > 3.31 261 2.1 < 3.31 262 263 2.1 < 3.31 264 2.1 > 3.31 265 2.1 == 3.31 266 2.1 > 3.31 267 2.1 < 3.31 268 269 2.1 < 3.31 270 2.1 > 3.31 271 2.1 == 3.31 272 2.1 > 3.31 273 2.1 < 3.31 274 275 2.1 < 3.31 276 2.1 > 3.31 277 2.1 == 3.31 278 2.1 > 3.31 279 2.1 < 3.31 280 281 2.1 < 3.31 282 2.1 > 3.31 283 2.1 == 3.31 284 2.1 > 3.31 285 2.1 < 3.31 286 287 2.1 < 3.31 288 2.1 > 3.31 289 2.1 == 3.31 290 2.1 > 3.31 291 2.1 < 3.31 292 293 2.1 < 3.31 294 2.1 > 3.31 295 2.1 == 3.31 296 2.1 > 3.31 297 2.1 < 3.31 298 299 2.1 < 3.31 300 2.1 > 3.31 301 2.1 == 3.31 302 2.1 > 3.31 303 2.1 < 3.31 304 305 2.1 < 3.31 306 2.1 > 3.31 307 2.1 == 3.31 308 2.1 > 3.31 309 2.1 < 3.31 310 311 2.1 < 3.31 312 2.1 > 3.31 313 2.1 == 3.31 314 2.1 > 3.31 315 2.1 < 3.31 316 317 2.1 < 3.31 318 2.1 > 3.31 319 2.1 == 3.31 320 2.1 > 3.31 321 2.1 < 3.31 322 323 2.1 < 3.31 324 2.1 > 3.31 325 2.1 == 3.31 326 2.1 > 3.31 327 2.1 < 3.31 328 329 2.1 < 3.31 330 2.1 > 3.31 331 2.1 == 3.31 332 2.1 > 3.31 333 2.1 < 3.31 334 335 2.1 < 3.31 336 2.1 > 3.31 337 2.1 == 3.31 338 2.1 > 3.31 339 2.1 < 3.31 340 341 2.1 < 3.31 342 2.1 > 3.31 343 2.1 == 3.31 344 2.1 > 3.31 345 2.1 < 3.31 346 347 2.1 < 3.31 348 2.1 > 3.31 349 2.1 == 3.31 350 2.1 > 3.31 351 2.1 < 3.31 352 353 2.1 < 3.31 354 2.1 > 3.31 355 2.1 == 3.31 356 2.1 > 3.31 357 2.1 < 3.31 358 359 2.1 < 3.31 360 2.1 > 3.31 361 2.1 == 3.31 362 2.1 > 3.31 363 2.1 < 3.31 364 365 2.1 < 3.31 366 2.1 > 3.31 367 2.1 == 3.31 368 2.1 > 3.31 369 2.1 < 3.31 370 371 2.1 < 3.31 372 2.1 > 3.31 373 2.1 == 3.31 374 2.1 > 3.31 375 2.1 < 3.31 376 377 2.1 < 3.31 378 2.1 > 3.31 379 2.1 == 3.31 380 2.1 > 3.31 381 2.1 < 3.31 382 383 2.1 < 3.31 384 2.1 > 3.31 385 2.1 == 3.31 386 2.1 > 3.31 387 2.1 < 3.31 388 389 def calibrate(self): 390 391 for i in xrange(self.rounds): 392 pass 393 394 395class CompareFloatsIntegers(Test): 396 397 version = 2.0 398 operations = 30 * 5 399 rounds = 60000 400 401 def test(self): 402 403 for i in xrange(self.rounds): 404 405 2.1 < 4 406 2.1 > 4 407 2.1 == 4 408 2.1 > 4 409 2.1 < 4 410 411 2.1 < 4 412 2.1 > 4 413 2.1 == 4 414 2.1 > 4 415 2.1 < 4 416 417 2.1 < 4 418 2.1 > 4 419 2.1 == 4 420 2.1 > 4 421 2.1 < 4 422 423 2.1 < 4 424 2.1 > 4 425 2.1 == 4 426 2.1 > 4 427 2.1 < 4 428 429 2.1 < 4 430 2.1 > 4 431 2.1 == 4 432 2.1 > 4 433 2.1 < 4 434 435 2.1 < 4 436 2.1 > 4 437 2.1 == 4 438 2.1 > 4 439 2.1 < 4 440 441 2.1 < 4 442 2.1 > 4 443 2.1 == 4 444 2.1 > 4 445 2.1 < 4 446 447 2.1 < 4 448 2.1 > 4 449 2.1 == 4 450 2.1 > 4 451 2.1 < 4 452 453 2.1 < 4 454 2.1 > 4 455 2.1 == 4 456 2.1 > 4 457 2.1 < 4 458 459 2.1 < 4 460 2.1 > 4 461 2.1 == 4 462 2.1 > 4 463 2.1 < 4 464 465 2.1 < 4 466 2.1 > 4 467 2.1 == 4 468 2.1 > 4 469 2.1 < 4 470 471 2.1 < 4 472 2.1 > 4 473 2.1 == 4 474 2.1 > 4 475 2.1 < 4 476 477 2.1 < 4 478 2.1 > 4 479 2.1 == 4 480 2.1 > 4 481 2.1 < 4 482 483 2.1 < 4 484 2.1 > 4 485 2.1 == 4 486 2.1 > 4 487 2.1 < 4 488 489 2.1 < 4 490 2.1 > 4 491 2.1 == 4 492 2.1 > 4 493 2.1 < 4 494 495 2.1 < 4 496 2.1 > 4 497 2.1 == 4 498 2.1 > 4 499 2.1 < 4 500 501 2.1 < 4 502 2.1 > 4 503 2.1 == 4 504 2.1 > 4 505 2.1 < 4 506 507 2.1 < 4 508 2.1 > 4 509 2.1 == 4 510 2.1 > 4 511 2.1 < 4 512 513 2.1 < 4 514 2.1 > 4 515 2.1 == 4 516 2.1 > 4 517 2.1 < 4 518 519 2.1 < 4 520 2.1 > 4 521 2.1 == 4 522 2.1 > 4 523 2.1 < 4 524 525 2.1 < 4 526 2.1 > 4 527 2.1 == 4 528 2.1 > 4 529 2.1 < 4 530 531 2.1 < 4 532 2.1 > 4 533 2.1 == 4 534 2.1 > 4 535 2.1 < 4 536 537 2.1 < 4 538 2.1 > 4 539 2.1 == 4 540 2.1 > 4 541 2.1 < 4 542 543 2.1 < 4 544 2.1 > 4 545 2.1 == 4 546 2.1 > 4 547 2.1 < 4 548 549 2.1 < 4 550 2.1 > 4 551 2.1 == 4 552 2.1 > 4 553 2.1 < 4 554 555 2.1 < 4 556 2.1 > 4 557 2.1 == 4 558 2.1 > 4 559 2.1 < 4 560 561 2.1 < 4 562 2.1 > 4 563 2.1 == 4 564 2.1 > 4 565 2.1 < 4 566 567 2.1 < 4 568 2.1 > 4 569 2.1 == 4 570 2.1 > 4 571 2.1 < 4 572 573 2.1 < 4 574 2.1 > 4 575 2.1 == 4 576 2.1 > 4 577 2.1 < 4 578 579 2.1 < 4 580 2.1 > 4 581 2.1 == 4 582 2.1 > 4 583 2.1 < 4 584 585 def calibrate(self): 586 587 for i in xrange(self.rounds): 588 pass 589 590 591class CompareLongs(Test): 592 593 version = 2.0 594 operations = 30 * 5 595 rounds = 70000 596 597 def test(self): 598 599 for i in xrange(self.rounds): 600 601 1234567890L < 3456789012345L 602 1234567890L > 3456789012345L 603 1234567890L == 3456789012345L 604 1234567890L > 3456789012345L 605 1234567890L < 3456789012345L 606 607 1234567890L < 3456789012345L 608 1234567890L > 3456789012345L 609 1234567890L == 3456789012345L 610 1234567890L > 3456789012345L 611 1234567890L < 3456789012345L 612 613 1234567890L < 3456789012345L 614 1234567890L > 3456789012345L 615 1234567890L == 3456789012345L 616 1234567890L > 3456789012345L 617 1234567890L < 3456789012345L 618 619 1234567890L < 3456789012345L 620 1234567890L > 3456789012345L 621 1234567890L == 3456789012345L 622 1234567890L > 3456789012345L 623 1234567890L < 3456789012345L 624 625 1234567890L < 3456789012345L 626 1234567890L > 3456789012345L 627 1234567890L == 3456789012345L 628 1234567890L > 3456789012345L 629 1234567890L < 3456789012345L 630 631 1234567890L < 3456789012345L 632 1234567890L > 3456789012345L 633 1234567890L == 3456789012345L 634 1234567890L > 3456789012345L 635 1234567890L < 3456789012345L 636 637 1234567890L < 3456789012345L 638 1234567890L > 3456789012345L 639 1234567890L == 3456789012345L 640 1234567890L > 3456789012345L 641 1234567890L < 3456789012345L 642 643 1234567890L < 3456789012345L 644 1234567890L > 3456789012345L 645 1234567890L == 3456789012345L 646 1234567890L > 3456789012345L 647 1234567890L < 3456789012345L 648 649 1234567890L < 3456789012345L 650 1234567890L > 3456789012345L 651 1234567890L == 3456789012345L 652 1234567890L > 3456789012345L 653 1234567890L < 3456789012345L 654 655 1234567890L < 3456789012345L 656 1234567890L > 3456789012345L 657 1234567890L == 3456789012345L 658 1234567890L > 3456789012345L 659 1234567890L < 3456789012345L 660 661 1234567890L < 3456789012345L 662 1234567890L > 3456789012345L 663 1234567890L == 3456789012345L 664 1234567890L > 3456789012345L 665 1234567890L < 3456789012345L 666 667 1234567890L < 3456789012345L 668 1234567890L > 3456789012345L 669 1234567890L == 3456789012345L 670 1234567890L > 3456789012345L 671 1234567890L < 3456789012345L 672 673 1234567890L < 3456789012345L 674 1234567890L > 3456789012345L 675 1234567890L == 3456789012345L 676 1234567890L > 3456789012345L 677 1234567890L < 3456789012345L 678 679 1234567890L < 3456789012345L 680 1234567890L > 3456789012345L 681 1234567890L == 3456789012345L 682 1234567890L > 3456789012345L 683 1234567890L < 3456789012345L 684 685 1234567890L < 3456789012345L 686 1234567890L > 3456789012345L 687 1234567890L == 3456789012345L 688 1234567890L > 3456789012345L 689 1234567890L < 3456789012345L 690 691 1234567890L < 3456789012345L 692 1234567890L > 3456789012345L 693 1234567890L == 3456789012345L 694 1234567890L > 3456789012345L 695 1234567890L < 3456789012345L 696 697 1234567890L < 3456789012345L 698 1234567890L > 3456789012345L 699 1234567890L == 3456789012345L 700 1234567890L > 3456789012345L 701 1234567890L < 3456789012345L 702 703 1234567890L < 3456789012345L 704 1234567890L > 3456789012345L 705 1234567890L == 3456789012345L 706 1234567890L > 3456789012345L 707 1234567890L < 3456789012345L 708 709 1234567890L < 3456789012345L 710 1234567890L > 3456789012345L 711 1234567890L == 3456789012345L 712 1234567890L > 3456789012345L 713 1234567890L < 3456789012345L 714 715 1234567890L < 3456789012345L 716 1234567890L > 3456789012345L 717 1234567890L == 3456789012345L 718 1234567890L > 3456789012345L 719 1234567890L < 3456789012345L 720 721 1234567890L < 3456789012345L 722 1234567890L > 3456789012345L 723 1234567890L == 3456789012345L 724 1234567890L > 3456789012345L 725 1234567890L < 3456789012345L 726 727 1234567890L < 3456789012345L 728 1234567890L > 3456789012345L 729 1234567890L == 3456789012345L 730 1234567890L > 3456789012345L 731 1234567890L < 3456789012345L 732 733 1234567890L < 3456789012345L 734 1234567890L > 3456789012345L 735 1234567890L == 3456789012345L 736 1234567890L > 3456789012345L 737 1234567890L < 3456789012345L 738 739 1234567890L < 3456789012345L 740 1234567890L > 3456789012345L 741 1234567890L == 3456789012345L 742 1234567890L > 3456789012345L 743 1234567890L < 3456789012345L 744 745 1234567890L < 3456789012345L 746 1234567890L > 3456789012345L 747 1234567890L == 3456789012345L 748 1234567890L > 3456789012345L 749 1234567890L < 3456789012345L 750 751 1234567890L < 3456789012345L 752 1234567890L > 3456789012345L 753 1234567890L == 3456789012345L 754 1234567890L > 3456789012345L 755 1234567890L < 3456789012345L 756 757 1234567890L < 3456789012345L 758 1234567890L > 3456789012345L 759 1234567890L == 3456789012345L 760 1234567890L > 3456789012345L 761 1234567890L < 3456789012345L 762 763 1234567890L < 3456789012345L 764 1234567890L > 3456789012345L 765 1234567890L == 3456789012345L 766 1234567890L > 3456789012345L 767 1234567890L < 3456789012345L 768 769 1234567890L < 3456789012345L 770 1234567890L > 3456789012345L 771 1234567890L == 3456789012345L 772 1234567890L > 3456789012345L 773 1234567890L < 3456789012345L 774 775 1234567890L < 3456789012345L 776 1234567890L > 3456789012345L 777 1234567890L == 3456789012345L 778 1234567890L > 3456789012345L 779 1234567890L < 3456789012345L 780 781 def calibrate(self): 782 783 for i in xrange(self.rounds): 784 pass 785