Lines 39-45
Link Here
|
39 |
// Tests counters |
39 |
// Tests counters |
40 |
static int TESTS_COUNT = 0; |
40 |
static int TESTS_COUNT = 0; |
41 |
private final static int WARMUP_COUNT = 1; // 30; |
41 |
private final static int WARMUP_COUNT = 1; // 30; |
42 |
private final static int ITERATIONS_COUNT = 1000; |
|
|
43 |
private final static int FOLDERS_COUNT = 200; |
42 |
private final static int FOLDERS_COUNT = 200; |
44 |
private final static int PACKAGES_COUNT = 200; |
43 |
private final static int PACKAGES_COUNT = 200; |
45 |
static int TESTS_LENGTH; |
44 |
static int TESTS_LENGTH; |
Lines 312-318
Link Here
|
312 |
* First wait that already started indexing jobs end before perform test. |
311 |
* First wait that already started indexing jobs end before perform test. |
313 |
* Perform one find before measure performance for warm-up. |
312 |
* Perform one find before measure performance for warm-up. |
314 |
*/ |
313 |
*/ |
315 |
public void testPerfNameLookupFindKnownType() throws CoreException { |
314 |
public void testNameLookupFindKnownType() throws CoreException { |
316 |
|
315 |
|
317 |
// Wait for indexing end |
316 |
// Wait for indexing end |
318 |
AbstractJavaModelTests.waitUntilIndexesReady(); |
317 |
AbstractJavaModelTests.waitUntilIndexesReady(); |
Lines 333-339
Link Here
|
333 |
for (int i=0; i<MEASURES_COUNT; i++) { |
332 |
for (int i=0; i<MEASURES_COUNT; i++) { |
334 |
runGc(); |
333 |
runGc(); |
335 |
startMeasuring(); |
334 |
startMeasuring(); |
336 |
for (int n=0; n<ITERATIONS_COUNT; n++) { |
335 |
for (int n=0; n<50000; n++) { |
337 |
NameLookup nameLookup = BIG_PROJECT.newNameLookup(DefaultWorkingCopyOwner.PRIMARY); |
336 |
NameLookup nameLookup = BIG_PROJECT.newNameLookup(DefaultWorkingCopyOwner.PRIMARY); |
338 |
nameLookup.findType(fullQualifiedName, false /*full match*/, NameLookup.ACCEPT_ALL); |
337 |
nameLookup.findType(fullQualifiedName, false /*full match*/, NameLookup.ACCEPT_ALL); |
339 |
} |
338 |
} |
Lines 351-357
Link Here
|
351 |
* First wait that already started indexing jobs end before perform test. |
350 |
* First wait that already started indexing jobs end before perform test. |
352 |
* Perform one find before measure performance for warm-up. |
351 |
* Perform one find before measure performance for warm-up. |
353 |
*/ |
352 |
*/ |
354 |
public void testPerfNameLookupFindKnownSecondaryType() throws CoreException { |
353 |
public void testNameLookupFindKnownSecondaryType() throws CoreException { |
355 |
|
354 |
|
356 |
// Wait for indexing end |
355 |
// Wait for indexing end |
357 |
AbstractJavaModelTests.waitUntilIndexesReady(); |
356 |
AbstractJavaModelTests.waitUntilIndexesReady(); |
Lines 374-380
Link Here
|
374 |
for (int i=0; i<MEASURES_COUNT; i++) { |
373 |
for (int i=0; i<MEASURES_COUNT; i++) { |
375 |
runGc(); |
374 |
runGc(); |
376 |
startMeasuring(); |
375 |
startMeasuring(); |
377 |
for (int n=0; n<ITERATIONS_COUNT; n++) { |
376 |
for (int n=0; n<50000; n++) { |
378 |
NameLookup nameLookup = BIG_PROJECT.newNameLookup(DefaultWorkingCopyOwner.PRIMARY); |
377 |
NameLookup nameLookup = BIG_PROJECT.newNameLookup(DefaultWorkingCopyOwner.PRIMARY); |
379 |
nameLookup.findType(fullQualifiedName, false /*full match*/, NameLookup.ACCEPT_ALL); |
378 |
nameLookup.findType(fullQualifiedName, false /*full match*/, NameLookup.ACCEPT_ALL); |
380 |
} |
379 |
} |
Lines 392-398
Link Here
|
392 |
* First wait that already started indexing jobs end before perform test. |
391 |
* First wait that already started indexing jobs end before perform test. |
393 |
* Perform one find before measure performance for warm-up. |
392 |
* Perform one find before measure performance for warm-up. |
394 |
*/ |
393 |
*/ |
395 |
public void testPerfNameLookupFindUnknownType() throws CoreException { |
394 |
public void testNameLookupFindUnknownType() throws CoreException { |
396 |
|
395 |
|
397 |
// Wait for indexing end |
396 |
// Wait for indexing end |
398 |
AbstractJavaModelTests.waitUntilIndexesReady(); |
397 |
AbstractJavaModelTests.waitUntilIndexesReady(); |
Lines 413-419
Link Here
|
413 |
for (int i=0; i<MEASURES_COUNT; i++) { |
412 |
for (int i=0; i<MEASURES_COUNT; i++) { |
414 |
runGc(); |
413 |
runGc(); |
415 |
startMeasuring(); |
414 |
startMeasuring(); |
416 |
for (int n=0; n<ITERATIONS_COUNT; n++) { |
415 |
for (int n=0; n<50000; n++) { |
417 |
NameLookup nameLookup = BIG_PROJECT.newNameLookup(DefaultWorkingCopyOwner.PRIMARY); |
416 |
NameLookup nameLookup = BIG_PROJECT.newNameLookup(DefaultWorkingCopyOwner.PRIMARY); |
418 |
nameLookup.findType(fullQualifiedName, false /*full match*/, NameLookup.ACCEPT_ALL); |
417 |
nameLookup.findType(fullQualifiedName, false /*full match*/, NameLookup.ACCEPT_ALL); |
419 |
} |
418 |
} |
Lines 431-437
Link Here
|
431 |
* First wait that already started indexing jobs end before perform test. |
430 |
* First wait that already started indexing jobs end before perform test. |
432 |
* Perform one find before measure performance for warm-up. |
431 |
* Perform one find before measure performance for warm-up. |
433 |
*/ |
432 |
*/ |
434 |
public void testPerfProjectFindKnownType() throws CoreException { |
433 |
public void testProjectFindKnownType() throws CoreException { |
435 |
tagAsSummary("Find known type in project", false); // do NOT put in fingerprint |
434 |
tagAsSummary("Find known type in project", false); // do NOT put in fingerprint |
436 |
|
435 |
|
437 |
// Wait for indexing end |
436 |
// Wait for indexing end |
Lines 452-458
Link Here
|
452 |
for (int i=0; i<MEASURES_COUNT; i++) { |
451 |
for (int i=0; i<MEASURES_COUNT; i++) { |
453 |
runGc(); |
452 |
runGc(); |
454 |
startMeasuring(); |
453 |
startMeasuring(); |
455 |
for (int n=0; n<ITERATIONS_COUNT; n++) { |
454 |
for (int n=0; n<50000; n++) { |
456 |
BIG_PROJECT.findType(fullQualifiedName); |
455 |
BIG_PROJECT.findType(fullQualifiedName); |
457 |
} |
456 |
} |
458 |
stopMeasuring(); |
457 |
stopMeasuring(); |
Lines 469-475
Link Here
|
469 |
* First wait that already started indexing jobs end before perform test. |
468 |
* First wait that already started indexing jobs end before perform test. |
470 |
* Perform one find before measure performance for warm-up. |
469 |
* Perform one find before measure performance for warm-up. |
471 |
*/ |
470 |
*/ |
472 |
public void testPerfProjectFindKnownMemberType() throws CoreException { |
471 |
public void testProjectFindKnownMemberType() throws CoreException { |
473 |
tagAsSummary("Find known member type in project", false); // do NOT put in fingerprint |
472 |
tagAsSummary("Find known member type in project", false); // do NOT put in fingerprint |
474 |
|
473 |
|
475 |
// Wait for indexing end |
474 |
// Wait for indexing end |
Lines 493-499
Link Here
|
493 |
for (int i=0; i<MEASURES_COUNT; i++) { |
492 |
for (int i=0; i<MEASURES_COUNT; i++) { |
494 |
runGc(); |
493 |
runGc(); |
495 |
startMeasuring(); |
494 |
startMeasuring(); |
496 |
for (int n=0; n<ITERATIONS_COUNT; n++) { |
495 |
for (int n=0; n<4000; n++) { |
497 |
BIG_PROJECT.findType(fullQualifiedName); |
496 |
BIG_PROJECT.findType(fullQualifiedName); |
498 |
} |
497 |
} |
499 |
stopMeasuring(); |
498 |
stopMeasuring(); |
Lines 510-516
Link Here
|
510 |
* First wait that already started indexing jobs end before perform test. |
509 |
* First wait that already started indexing jobs end before perform test. |
511 |
* Perform one find before measure performance for warm-up. |
510 |
* Perform one find before measure performance for warm-up. |
512 |
*/ |
511 |
*/ |
513 |
public void testPerfProjectFindKnownSecondaryType() throws CoreException { |
512 |
public void testProjectFindKnownSecondaryType() throws CoreException { |
514 |
tagAsSummary("Find known secondary type in project", false); // do NOT put in fingerprint |
513 |
tagAsSummary("Find known secondary type in project", false); // do NOT put in fingerprint |
515 |
|
514 |
|
516 |
// Wait for indexing end |
515 |
// Wait for indexing end |
Lines 530-536
Link Here
|
530 |
for (int i=0; i<MEASURES_COUNT; i++) { |
529 |
for (int i=0; i<MEASURES_COUNT; i++) { |
531 |
runGc(); |
530 |
runGc(); |
532 |
startMeasuring(); |
531 |
startMeasuring(); |
533 |
for (int n=0; n<ITERATIONS_COUNT; n++) { |
532 |
for (int n=0; n<1000; n++) { |
534 |
BIG_PROJECT.findType(fullQualifiedName); |
533 |
BIG_PROJECT.findType(fullQualifiedName); |
535 |
} |
534 |
} |
536 |
stopMeasuring(); |
535 |
stopMeasuring(); |
Lines 547-553
Link Here
|
547 |
* First wait that already started indexing jobs end before perform test. |
546 |
* First wait that already started indexing jobs end before perform test. |
548 |
* Perform one find before measure performance for warm-up. |
547 |
* Perform one find before measure performance for warm-up. |
549 |
*/ |
548 |
*/ |
550 |
public void testPerfProjectFindUnknownType() throws CoreException { |
549 |
public void testProjectFindUnknownType() throws CoreException { |
551 |
tagAsSummary("Find unknown type in project", false); // do NOT put in fingerprint |
550 |
tagAsSummary("Find unknown type in project", false); // do NOT put in fingerprint |
552 |
|
551 |
|
553 |
// Wait for indexing end |
552 |
// Wait for indexing end |
Lines 568-574
Link Here
|
568 |
for (int i=0; i<MEASURES_COUNT; i++) { |
567 |
for (int i=0; i<MEASURES_COUNT; i++) { |
569 |
runGc(); |
568 |
runGc(); |
570 |
startMeasuring(); |
569 |
startMeasuring(); |
571 |
for (int n=0; n<ITERATIONS_COUNT; n++) { |
570 |
for (int n=0; n<2000; n++) { |
572 |
BIG_PROJECT.findType(fullQualifiedName); |
571 |
BIG_PROJECT.findType(fullQualifiedName); |
573 |
} |
572 |
} |
574 |
stopMeasuring(); |
573 |
stopMeasuring(); |
Lines 748-754
Link Here
|
748 |
* Performance test for looking up package fragments |
747 |
* Performance test for looking up package fragments |
749 |
* (see bug 72683 Slow code assist in Display view) |
748 |
* (see bug 72683 Slow code assist in Display view) |
750 |
*/ |
749 |
*/ |
751 |
public void testPerfSeekPackageFragments() throws CoreException { |
750 |
public void testSeekPackageFragments() throws CoreException { |
752 |
assertNotNull("We should have the 'BigProject' in workspace!", BIG_PROJECT); |
751 |
assertNotNull("We should have the 'BigProject' in workspace!", BIG_PROJECT); |
753 |
class PackageRequestor implements IJavaElementRequestor { |
752 |
class PackageRequestor implements IJavaElementRequestor { |
754 |
ArrayList pkgs = new ArrayList(); |
753 |
ArrayList pkgs = new ArrayList(); |
Lines 784-790
Link Here
|
784 |
for (int i = 0; i < MEASURES_COUNT; i++) { |
783 |
for (int i = 0; i < MEASURES_COUNT; i++) { |
785 |
runGc(); |
784 |
runGc(); |
786 |
startMeasuring(); |
785 |
startMeasuring(); |
787 |
for (int j = 0; j < ITERATIONS_COUNT; j++) { |
786 |
for (int j = 0; j < 50000; j++) { |
788 |
getNameLookup(BIG_PROJECT).seekPackageFragments("org.eclipse.jdt.core.tests" + j + "0.performance" + j, false/*not partial match*/, requestor); |
787 |
getNameLookup(BIG_PROJECT).seekPackageFragments("org.eclipse.jdt.core.tests" + j + "0.performance" + j, false/*not partial match*/, requestor); |
789 |
} |
788 |
} |
790 |
stopMeasuring(); |
789 |
stopMeasuring(); |
Lines 793-798
Link Here
|
793 |
assertPerformance(); |
792 |
assertPerformance(); |
794 |
} |
793 |
} |
795 |
|
794 |
|
|
|
795 |
public void testCloseProjects() throws JavaModelException { |
796 |
// store current settings |
797 |
long oldSnapInterval = ENV.getWorkspace().getDescription().getSnapshotInterval(); |
798 |
boolean oldAutoBuildPolicy = ENV.isAutoBuilding(); |
799 |
|
800 |
// prevent snapshots and autobuilds from disturbing our measures |
801 |
ENV.getWorkspace().getDescription().setSnapshotInterval(100000); |
802 |
ENV.getWorkspace().getDescription().setAutoBuilding(false); |
803 |
|
804 |
try { |
805 |
int length=ALL_PROJECTS.length; |
806 |
// Warm-up |
807 |
for (int i=0; i<WARMUP_COUNT; i++) { |
808 |
for (int j=0; j<length; j++) { |
809 |
ENV.closeProject(ALL_PROJECTS[j].getPath()); |
810 |
} |
811 |
for (int j=0; j<length; j++) { |
812 |
ENV.openProject(ALL_PROJECTS[j].getPath()); |
813 |
} |
814 |
} |
815 |
|
816 |
// Measures |
817 |
for (int i=0; i<MEASURES_COUNT; i++) { |
818 |
AbstractJavaModelTests.waitUntilIndexesReady(); |
819 |
// should not be autobuilding... |
820 |
if (ENV.isAutoBuilding()) { |
821 |
ENV.waitForAutoBuild(); |
822 |
} |
823 |
runGc(); |
824 |
startMeasuring(); |
825 |
for (int j=0; j<length; j++) { |
826 |
ENV.closeProject(ALL_PROJECTS[j].getPath()); |
827 |
} |
828 |
stopMeasuring(); |
829 |
for (int j=0; j<length; j++) { |
830 |
ENV.openProject(ALL_PROJECTS[j].getPath()); |
831 |
} |
832 |
} |
833 |
// Commit |
834 |
commitMeasurements(); |
835 |
assertPerformance(); |
836 |
} |
837 |
finally { |
838 |
// restore previous settings |
839 |
ENV.getWorkspace().getDescription().setSnapshotInterval(oldSnapInterval); |
840 |
ENV.getWorkspace().getDescription().setAutoBuilding(oldAutoBuildPolicy); |
841 |
} |
842 |
} |
843 |
|
844 |
public void testStartJDTPlugin() throws JavaModelException { |
845 |
// store current settings |
846 |
long oldSnapInterval = ENV.getWorkspace().getDescription().getSnapshotInterval(); |
847 |
// prevent snapshots and autobuilds from disturbing our measures |
848 |
ENV.getWorkspace().getDescription().setSnapshotInterval(100000); |
849 |
try { |
850 |
// Warm-up |
851 |
for (int i=0; i<WARMUP_COUNT; i++) { |
852 |
simulateExitRestart(); |
853 |
JavaCore.initializeAfterLoad(null); |
854 |
AbstractJavaModelTests.waitUntilIndexesReady(); |
855 |
} |
856 |
|
857 |
// Measures |
858 |
for (int i=0; i<MEASURES_COUNT; i++) { |
859 |
// shutdwon |
860 |
simulateExit(); |
861 |
runGc(); |
862 |
startMeasuring(); |
863 |
// restart |
864 |
simulateRestart(); |
865 |
JavaCore.initializeAfterLoad(null); |
866 |
AbstractJavaModelTests.waitUntilIndexesReady(); |
867 |
stopMeasuring(); |
868 |
} |
869 |
// Commit |
870 |
commitMeasurements(); |
871 |
assertPerformance(); |
872 |
} |
873 |
catch (CoreException ex) { |
874 |
// do nothing |
875 |
} |
876 |
finally { |
877 |
// restore previous settings |
878 |
ENV.getWorkspace().getDescription().setSnapshotInterval(oldSnapInterval); |
879 |
} |
880 |
} |
881 |
|
796 |
protected void resetCounters() { |
882 |
protected void resetCounters() { |
797 |
// do nothing |
883 |
// do nothing |
798 |
} |
884 |
} |