1 9 package javolution; 10 11 import j2me.util.ArrayList; 12 import j2me.util.HashMap; 13 import j2me.util.HashSet; 14 import j2me.util.Iterator; 15 import j2me.util.LinkedHashMap; 16 import j2me.util.LinkedHashSet; 17 import j2me.util.LinkedList; 18 import j2me.util.RandomAccess; 19 20 import javolution.util.FastList; 21 import javolution.util.FastMap; 22 import javolution.util.FastSet; 23 import javolution.util.FastTable; 24 25 31 final class PerfUtil extends Javolution implements Runnable { 32 33 private static final int MAX_COLLECTION_SIZE = 10000; 34 35 private static final int ITERATIONS = 100; 36 37 private final Object [] _objects = new Object [MAX_COLLECTION_SIZE]; 38 39 42 public void run() throws JavolutionError { 43 44 println("//////////////////////////////"); 45 println("// Package: javolution.util //"); 46 println("//////////////////////////////"); 47 println(""); 48 println("(new) : The collection is created (using the new keyword), populated, then discarded (throw-away collections)."); 49 println("(recycled) : The collection is cleared, populated, then reused (static collections or throw-away collections in PoolContext)."); 50 println(""); 51 52 for (int i = 0; i < MAX_COLLECTION_SIZE; i++) { 54 _objects[i] = new Object (); 55 } 56 57 println("-- FastTable versus ArrayList -- "); 58 benchmarkFastTable(); 59 benchmarkArrayList(); 60 61 println("-- FastList versus LinkedList -- "); 62 benchmarkFastList(); 63 benchmarkLinkedList(); 64 println(""); 65 66 println("-- FastMap versus HashMap --"); 67 benchmarkFastMap(); 68 benchmarkHashMap(); 69 benchmarkLinkedHashMap(); 70 println(""); 71 72 println("-- FastMap.setShared(true) versus ConcurrentHashMap --"); 73 benchmarkSharedFastMap(); 74 77 println(""); 78 79 println("-- FastSet versus HashSet --"); 80 benchmarkFastSet(); 81 benchmarkHashSet(); 82 benchmarkLinkedHashSet(); 83 println(""); 84 85 } 86 87 private void benchmarkFastTable() { 88 FastTable list = new FastTable(); 89 println(list.getClass()); 90 91 for (int size = 10; size <= MAX_COLLECTION_SIZE; size *= 10) { 92 final int iterations = 10 * MAX_COLLECTION_SIZE / size; 93 print(" Size: " + size); 94 95 print(", add (new): "); 96 for (int n = 0; n < ITERATIONS; n++) { 97 startTime(); 98 for (int j = 0; j < iterations; j++) { 99 list = new FastTable(); 100 for (int i = 0; i < size;) { 101 list.add(_objects[i++]); 102 } 103 } 104 keepBestTime(size * iterations); 105 } 106 print(endTime()); 107 108 print(", add (recycled): "); 109 for (int n = 0; n < ITERATIONS; n++) { 110 startTime(); 111 for (int j = 0; j < iterations; j++) { 112 list.clear(); 113 for (int i = 0; i < size;) { 114 list.add(_objects[i++]); 115 } 116 } 117 keepBestTime(size * iterations); 118 } 119 print(endTime()); 120 121 print(", iteration (iterator): "); 122 for (int n = 0; n < ITERATIONS; n++) { 123 startTime(); 124 for (int j = 0; j < iterations; j++) { 125 for (Iterator i = list.iterator(); i.hasNext();) { 126 if (i.next() == list) 127 throw new Error (); 128 } 129 } 130 keepBestTime(size * iterations); 131 } 132 print(endTime()); 133 134 if (list instanceof RandomAccess) { 135 print(", get(int): "); 136 for (int n = 0; n < ITERATIONS; n++) { 137 startTime(); 138 for (int j = 0; j < iterations; j++) { 139 for (int i = list.size(); --i > 0;) { 140 if (list.get(i) == list) 141 throw new Error (); 142 } 143 } 144 keepBestTime(size * iterations); 145 } 146 print(endTime()); 147 } 148 149 println(""); 150 } 151 println(""); 152 } 153 154 private void benchmarkFastList() { 155 FastList list = new FastList(); 156 println(list.getClass()); 157 158 for (int size = 10; size <= MAX_COLLECTION_SIZE; size *= 10) { 159 final int iterations = 10 * MAX_COLLECTION_SIZE / size; 160 print(" Size: " + size); 161 162 print(", add (new): "); 163 for (int n = 0; n < ITERATIONS; n++) { 164 startTime(); 165 for (int j = 0; j < iterations; j++) { 166 list = new FastList(); 167 for (int i = 0; i < size;) { 168 list.add(_objects[i++]); 169 } 170 } 171 keepBestTime(size * iterations); 172 } 173 print(endTime()); 174 175 print(", add (recycled): "); 176 for (int n = 0; n < ITERATIONS; n++) { 177 startTime(); 178 for (int j = 0; j < iterations; j++) { 179 list.clear(); 180 for (int i = 0; i < size;) { 181 list.add(_objects[i++]); 182 } 183 } 184 keepBestTime(size * iterations); 185 } 186 print(endTime()); 187 188 print(", iteration (iterator): "); 189 for (int n = 0; n < ITERATIONS; n++) { 190 startTime(); 191 for (int j = 0; j < iterations; j++) { 192 for (Iterator i = list.iterator(); i.hasNext();) { 193 if (i.next() == list) 194 throw new Error (); 195 } 196 } 197 keepBestTime(size * iterations); 198 } 199 print(endTime()); 200 201 print(", iteration (node): "); 202 FastList fl = (FastList) list; 203 for (int n = 0; n < ITERATIONS; n++) { 204 startTime(); 205 for (int j = 0; j < iterations; j++) { 206 for (FastList.Node nn = (FastList.Node) fl 207 .head(), end = (FastList.Node) fl 208 .tail(); (nn = (FastList.Node) nn 209 .getNext()) != end;) { 210 if (nn.getValue() == list) 211 throw new Error (); 212 } 213 } 214 keepBestTime(size * iterations); 215 } 216 print(endTime()); 217 218 if (list instanceof RandomAccess) { 219 print(", get(int): "); 220 for (int n = 0; n < ITERATIONS; n++) { 221 startTime(); 222 for (int j = 0; j < iterations; j++) { 223 for (int i = list.size(); --i > 0;) { 224 if (list.get(i) == list) 225 throw new Error (); 226 } 227 } 228 keepBestTime(size * iterations); 229 } 230 print(endTime()); 231 } 232 233 println(""); 234 } 235 println(""); 236 } 237 238 private void benchmarkArrayList() { 239 ArrayList list = new ArrayList(); 240 if (!list.getClass().getName().equals("java.util.ArrayList")) 241 return; println(list.getClass()); 243 244 for (int size = 10; size <= MAX_COLLECTION_SIZE; size *= 10) { 245 final int iterations = 10 * MAX_COLLECTION_SIZE / size; 246 print(" Size: " + size); 247 248 print(", add (new): "); 249 for (int n = 0; n < ITERATIONS; n++) { 250 startTime(); 251 for (int j = 0; j < iterations; j++) { 252 list = new ArrayList(); 253 for (int i = 0; i < size;) { 254 list.add(_objects[i++]); 255 } 256 } 257 keepBestTime(size * iterations); 258 } 259 print(endTime()); 260 261 print(", add (recycled): "); 262 for (int n = 0; n < ITERATIONS; n++) { 263 startTime(); 264 for (int j = 0; j < iterations; j++) { 265 list.clear(); 266 for (int i = 0; i < size;) { 267 list.add(_objects[i++]); 268 } 269 } 270 keepBestTime(size * iterations); 271 } 272 print(endTime()); 273 274 print(", iteration (iterator): "); 275 for (int n = 0; n < ITERATIONS; n++) { 276 startTime(); 277 for (int j = 0; j < iterations; j++) { 278 for (Iterator i = list.iterator(); i.hasNext();) { 279 if (i.next() == list) 280 throw new Error (); 281 } 282 } 283 keepBestTime(size * iterations); 284 } 285 print(endTime()); 286 287 if (list instanceof RandomAccess) { 288 print(", get(int): "); 289 for (int n = 0; n < ITERATIONS; n++) { 290 startTime(); 291 for (int j = 0; j < iterations; j++) { 292 for (int i = list.size(); --i > 0;) { 293 if (list.get(i) == list) 294 throw new Error (); 295 } 296 } 297 keepBestTime(size * iterations); 298 } 299 print(endTime()); 300 } 301 302 println(""); 303 } 304 println(""); 305 } 306 307 private void benchmarkLinkedList() { 308 LinkedList list = new LinkedList(); 309 if (!list.getClass().getName().equals("java.util.LinkedList")) 310 return; println(list.getClass()); 312 313 for (int size = 10; size <= MAX_COLLECTION_SIZE; size *= 10) { 314 final int iterations = 10 * MAX_COLLECTION_SIZE / size; 315 print(" Size: " + size); 316 317 print(", add (new): "); 318 for (int n = 0; n < ITERATIONS; n++) { 319 startTime(); 320 for (int j = 0; j < iterations; j++) { 321 list = new LinkedList(); 322 for (int i = 0; i < size;) { 323 list.add(_objects[i++]); 324 } 325 } 326 keepBestTime(size * iterations); 327 } 328 print(endTime()); 329 330 print(", add (recycled): "); 331 for (int n = 0; n < ITERATIONS; n++) { 332 startTime(); 333 for (int j = 0; j < iterations; j++) { 334 list.clear(); 335 for (int i = 0; i < size;) { 336 list.add(_objects[i++]); 337 } 338 } 339 keepBestTime(size * iterations); 340 } 341 print(endTime()); 342 343 print(", iteration (iterator): "); 344 for (int n = 0; n < ITERATIONS; n++) { 345 startTime(); 346 for (int j = 0; j < iterations; j++) { 347 for (Iterator i = list.iterator(); i.hasNext();) { 348 if (i.next() == list) 349 throw new Error (); 350 } 351 } 352 keepBestTime(size * iterations); 353 } 354 print(endTime()); 355 356 if (list instanceof RandomAccess) { 357 print(", get(int): "); 358 for (int n = 0; n < ITERATIONS; n++) { 359 startTime(); 360 for (int j = 0; j < iterations; j++) { 361 for (int i = list.size(); --i > 0;) { 362 if (list.get(i) == list) 363 throw new Error (); 364 } 365 } 366 keepBestTime(size * iterations); 367 } 368 print(endTime()); 369 } 370 371 println(""); 372 } 373 println(""); 374 } 375 376 private void benchmarkFastMap() { 377 FastMap map = new FastMap(); 378 println(map.getClass()); 379 380 for (int size = 10; size <= MAX_COLLECTION_SIZE; size *= 10) { 381 final int iterations = 10 * MAX_COLLECTION_SIZE / size; 382 print(" Size: " + size); 383 384 print(", put (new): "); 385 for (int n = 0; n < ITERATIONS; n++) { 386 startTime(); 387 for (int j = 0; j < iterations; j++) { 388 map = new FastMap(); 389 for (int i = 0; i < size;) { 390 map.put(_objects[i++], ""); 391 } 392 } 393 keepBestTime(size * iterations); 394 } 395 print(endTime()); 396 397 print(", put (recycled): "); 398 for (int n = 0; n < ITERATIONS; n++) { 399 startTime(); 400 for (int j = 0; j < iterations; j++) { 401 map.clear(); 402 for (int i = 0; i < size;) { 403 map.put(_objects[i++], ""); 404 } 405 } 406 keepBestTime(size * iterations); 407 } 408 print(endTime()); 409 410 print(", get: "); 411 for (int n = 0; n < ITERATIONS; n++) { 412 startTime(); 413 for (int j = 0; j < iterations; j++) { 414 for (int i = 0; i < size;) { 415 if (map.get(_objects[i++]) != "") 416 throw new Error (); 417 } 418 } 419 keepBestTime(size * iterations); 420 } 421 print(endTime()); 422 423 print(", iteration (iterator): "); 424 for (int n = 0; n < ITERATIONS; n++) { 425 startTime(); 426 for (int j = 0; j < iterations; j++) { 427 for (Iterator i = map.entrySet().iterator(); i.hasNext();) { 428 if (i.next() == map) 429 throw new Error (); 430 } 431 } 432 keepBestTime(size * iterations); 433 } 434 print(endTime()); 435 436 print(", iteration (entry): "); 437 for (int n = 0; n < ITERATIONS; n++) { 438 startTime(); 439 for (int j = 0; j < iterations; j++) { 440 for (FastMap.Entry e = map.head(), end = map.tail(); (e = (FastMap.Entry) e 441 .getNext()) != end;) { 442 if (e.getValue() == map) 443 throw new Error (); 444 } 445 } 446 keepBestTime(size * iterations); 447 } 448 print(endTime()); 449 450 println(""); 451 } 452 println(""); 453 454 } 455 456 private void benchmarkHashMap() { 457 HashMap map = new HashMap(); 458 if (!map.getClass().getName().equals("java.util.HashMap")) 459 return; println(map.getClass()); 461 462 for (int size = 10; size <= MAX_COLLECTION_SIZE; size *= 10) { 463 final int iterations = 10 * MAX_COLLECTION_SIZE / size; 464 print(" Size: " + size); 465 466 print(", put (new): "); 467 for (int n = 0; n < ITERATIONS; n++) { 468 startTime(); 469 for (int j = 0; j < iterations; j++) { 470 map = new HashMap(); 471 for (int i = 0; i < size;) { 472 map.put(_objects[i++], ""); 473 } 474 } 475 keepBestTime(size * iterations); 476 } 477 print(endTime()); 478 479 print(", put (recycled): "); 480 for (int n = 0; n < ITERATIONS; n++) { 481 startTime(); 482 for (int j = 0; j < iterations; j++) { 483 map.clear(); 484 for (int i = 0; i < size;) { 485 map.put(_objects[i++], ""); 486 } 487 } 488 keepBestTime(size * iterations); 489 } 490 print(endTime()); 491 492 print(", get: "); 493 for (int n = 0; n < ITERATIONS; n++) { 494 startTime(); 495 for (int j = 0; j < iterations; j++) { 496 for (int i = 0; i < size;) { 497 if (map.get(_objects[i++]) != "") 498 throw new Error (); 499 } 500 } 501 keepBestTime(size * iterations); 502 } 503 print(endTime()); 504 505 print(", iteration (iterator): "); 506 for (int n = 0; n < ITERATIONS; n++) { 507 startTime(); 508 for (int j = 0; j < iterations; j++) { 509 for (Iterator i = map.entrySet().iterator(); i.hasNext();) { 510 if (i.next() == map) 511 throw new Error (); 512 } 513 } 514 keepBestTime(size * iterations); 515 } 516 print(endTime()); 517 518 println(""); 519 } 520 println(""); 521 } 522 523 private void benchmarkSharedFastMap() { 524 FastMap map = new FastMap().setShared(true); 525 println("Shared FastMap"); 526 527 for (int size = 10; size <= MAX_COLLECTION_SIZE; size *= 10) { 528 final int iterations = 10 * MAX_COLLECTION_SIZE / size; 529 print(" Size: " + size); 530 531 print(", put (new): "); 532 for (int n = 0; n < ITERATIONS; n++) { 533 startTime(); 534 for (int j = 0; j < iterations; j++) { 535 map = new FastMap().setShared(true); 536 for (int i = 0; i < size;) { 537 map.put(_objects[i++], ""); 538 } 539 } 540 keepBestTime(size * iterations); 541 } 542 print(endTime()); 543 544 print(", put (recycled): "); 545 for (int n = 0; n < ITERATIONS; n++) { 546 startTime(); 547 for (int j = 0; j < iterations; j++) { 548 map.clear(); 549 for (int i = 0; i < size;) { 550 map.put(_objects[i++], ""); 551 } 552 } 553 keepBestTime(size * iterations); 554 } 555 print(endTime()); 556 557 print(", get: "); 558 for (int n = 0; n < ITERATIONS; n++) { 559 startTime(); 560 for (int j = 0; j < iterations; j++) { 561 for (int i = 0; i < size;) { 562 if (map.get(_objects[i++]) != "") 563 throw new Error (); 564 } 565 } 566 keepBestTime(size * iterations); 567 } 568 print(endTime()); 569 570 print(", iteration (iterator): "); 571 for (int n = 0; n < ITERATIONS; n++) { 572 startTime(); 573 for (int j = 0; j < iterations; j++) { 574 for (Iterator i = map.entrySet().iterator(); i.hasNext();) { 575 if (i.next() == map) 576 throw new Error (); 577 } 578 } 579 keepBestTime(size * iterations); 580 } 581 print(endTime()); 582 583 print(", iteration (entry): "); 584 for (int n = 0; n < ITERATIONS; n++) { 585 startTime(); 586 for (int j = 0; j < iterations; j++) { 587 for (FastMap.Entry e = map.head(), end = map.tail(); (e = (FastMap.Entry) e 588 .getNext()) != end;) { 589 if (e.getValue() == map) 590 throw new Error (); 591 } 592 } 593 keepBestTime(size * iterations); 594 } 595 print(endTime()); 596 597 println(""); 598 } 599 println(""); 600 601 } 602 603 661 662 private void benchmarkLinkedHashMap() { 663 LinkedHashMap map = new LinkedHashMap(); 664 if (!map.getClass().getName().equals("java.util.LinkedHashMap")) 665 return; println(map.getClass()); 667 668 for (int size = 10; size <= MAX_COLLECTION_SIZE; size *= 10) { 669 final int iterations = 10 * MAX_COLLECTION_SIZE / size; 670 print(" Size: " + size); 671 672 print(", put (new): "); 673 for (int n = 0; n < ITERATIONS; n++) { 674 startTime(); 675 for (int j = 0; j < iterations; j++) { 676 map = new LinkedHashMap(); 677 for (int i = 0; i < size;) { 678 map.put(_objects[i++], ""); 679 } 680 } 681 keepBestTime(size * iterations); 682 } 683 print(endTime()); 684 685 print(", put (recycled): "); 686 for (int n = 0; n < ITERATIONS; n++) { 687 startTime(); 688 for (int j = 0; j < iterations; j++) { 689 map.clear(); 690 for (int i = 0; i < size;) { 691 map.put(_objects[i++], ""); 692 } 693 } 694 keepBestTime(size * iterations); 695 } 696 print(endTime()); 697 698 print(", get: "); 699 for (int n = 0; n < ITERATIONS; n++) { 700 startTime(); 701 for (int j = 0; j < iterations; j++) { 702 for (int i = 0; i < size;) { 703 if (map.get(_objects[i++]) != "") 704 throw new Error (); 705 } 706 } 707 keepBestTime(size * iterations); 708 } 709 print(endTime()); 710 711 print(", iteration (iterator): "); 712 for (int n = 0; n < ITERATIONS; n++) { 713 startTime(); 714 for (int j = 0; j < iterations; j++) { 715 for (Iterator i = map.entrySet().iterator(); i.hasNext();) { 716 if (i.next() == map) 717 throw new Error (); 718 } 719 } 720 keepBestTime(size * iterations); 721 } 722 print(endTime()); 723 724 println(""); 725 } 726 println(""); 727 } 728 729 private void benchmarkFastSet() { 730 FastSet set = new FastSet(); 731 println(set.getClass()); 732 733 for (int size = 10; size <= MAX_COLLECTION_SIZE; size *= 10) { 734 final int iterations = 10 * MAX_COLLECTION_SIZE / size; 735 print(" Size: " + size); 736 737 print(", add (new): "); 738 for (int n = 0; n < ITERATIONS; n++) { 739 startTime(); 740 for (int j = 0; j < iterations; j++) { 741 set = new FastSet(); 742 for (int i = 0; i < size;) { 743 set.add(_objects[i++]); 744 } 745 } 746 keepBestTime(size * iterations); 747 } 748 print(endTime()); 749 750 print(", add (recycled): "); 751 for (int n = 0; n < ITERATIONS; n++) { 752 startTime(); 753 for (int j = 0; j < iterations; j++) { 754 set.clear(); 755 for (int i = 0; i < size;) { 756 set.add(_objects[i++]); 757 } 758 } 759 keepBestTime(size * iterations); 760 } 761 print(endTime()); 762 763 print(", contain: "); 764 for (int n = 0; n < ITERATIONS; n++) { 765 startTime(); 766 for (int j = 0; j < iterations; j++) { 767 for (int i = 0; i < size;) { 768 if (!set.contains(_objects[i++])) 769 throw new Error (); 770 } 771 } 772 keepBestTime(size * iterations); 773 } 774 print(endTime()); 775 776 print(", iteration (iterator): "); 777 for (int n = 0; n < ITERATIONS; n++) { 778 startTime(); 779 for (int j = 0; j < iterations; j++) { 780 for (Iterator i = set.iterator(); i.hasNext();) { 781 if (i.next() == set) 782 throw new Error (); 783 } 784 } 785 keepBestTime(size * iterations); 786 } 787 print(endTime()); 788 789 print(", iteration (record): "); 790 for (int n = 0; n < ITERATIONS; n++) { 791 startTime(); 792 for (int j = 0; j < iterations; j++) { 793 for (FastSet.Record r = set.head(), end = set.tail(); (r = r 794 .getNext()) != end;) { 795 if (set.valueOf(r) == set) 796 throw new Error (); 797 } 798 } 799 keepBestTime(size * iterations); 800 } 801 print(endTime()); 802 803 println(""); 804 } 805 println(""); 806 807 } 808 809 private void benchmarkHashSet() { 810 HashSet set = new HashSet(); 811 if (!set.getClass().getName().equals("java.util.HashSet")) 812 return; println(set.getClass()); 814 815 for (int size = 10; size <= MAX_COLLECTION_SIZE; size *= 10) { 816 final int iterations = 10 * MAX_COLLECTION_SIZE / size; 817 print(" Size: " + size); 818 819 print(", add (new): "); 820 for (int n = 0; n < ITERATIONS; n++) { 821 startTime(); 822 for (int j = 0; j < iterations; j++) { 823 set = new HashSet(); 824 for (int i = 0; i < size;) { 825 set.add(_objects[i++]); 826 } 827 } 828 keepBestTime(size * iterations); 829 } 830 print(endTime()); 831 832 print(", add (recycled): "); 833 for (int n = 0; n < ITERATIONS; n++) { 834 startTime(); 835 for (int j = 0; j < iterations; j++) { 836 set.clear(); 837 for (int i = 0; i < size;) { 838 set.add(_objects[i++]); 839 } 840 } 841 keepBestTime(size * iterations); 842 } 843 print(endTime()); 844 845 print(", contain: "); 846 for (int n = 0; n < ITERATIONS; n++) { 847 startTime(); 848 for (int j = 0; j < iterations; j++) { 849 for (int i = 0; i < size;) { 850 if (!set.contains(_objects[i++])) 851 throw new Error (); 852 } 853 } 854 keepBestTime(size * iterations); 855 } 856 print(endTime()); 857 858 print(", iteration (iterator): "); 859 for (int n = 0; n < ITERATIONS; n++) { 860 startTime(); 861 for (int j = 0; j < iterations; j++) { 862 for (Iterator i = set.iterator(); i.hasNext();) { 863 if (i.next() == set) 864 throw new Error (); 865 } 866 } 867 keepBestTime(size * iterations); 868 } 869 print(endTime()); 870 871 println(""); 872 } 873 println(""); 874 875 } 876 877 private void benchmarkLinkedHashSet() { 878 LinkedHashSet set = new LinkedHashSet(); 879 if (!set.getClass().getName().equals("java.util.LinkedHashSet")) 880 return; println(set.getClass()); 882 883 for (int size = 10; size <= MAX_COLLECTION_SIZE; size *= 10) { 884 final int iterations = 10 * MAX_COLLECTION_SIZE / size; 885 print(" Size: " + size); 886 887 print(", add (new): "); 888 for (int n = 0; n < ITERATIONS; n++) { 889 startTime(); 890 for (int j = 0; j < iterations; j++) { 891 set = new LinkedHashSet(); 892 for (int i = 0; i < size;) { 893 set.add(_objects[i++]); 894 } 895 } 896 keepBestTime(size * iterations); 897 } 898 print(endTime()); 899 900 print(", add (recycled): "); 901 for (int n = 0; n < ITERATIONS; n++) { 902 startTime(); 903 for (int j = 0; j < iterations; j++) { 904 set.clear(); 905 for (int i = 0; i < size;) { 906 set.add(_objects[i++]); 907 } 908 } 909 keepBestTime(size * iterations); 910 } 911 print(endTime()); 912 913 print(", contain: "); 914 for (int n = 0; n < ITERATIONS; n++) { 915 startTime(); 916 for (int j = 0; j < iterations; j++) { 917 for (int i = 0; i < size;) { 918 if (!set.contains(_objects[i++])) 919 throw new Error (); 920 } 921 } 922 keepBestTime(size * iterations); 923 } 924 print(endTime()); 925 926 print(", iteration (iterator): "); 927 for (int n = 0; n < ITERATIONS; n++) { 928 startTime(); 929 for (int j = 0; j < iterations; j++) { 930 for (Iterator i = set.iterator(); i.hasNext();) { 931 if (i.next() == set) 932 throw new Error (); 933 } 934 } 935 keepBestTime(size * iterations); 936 } 937 print(endTime()); 938 939 println(""); 940 } 941 println(""); 942 943 } 944 } 945 | Popular Tags |