Bug 212137 - [search] PossibleMatchSet perform a linear search to see whether a PossibleMatch has been already stored
Summary: [search] PossibleMatchSet perform a linear search to see whether a PossibleMa...
Status: VERIFIED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2007-12-06 06:57 EST by Frederic Fusier CLA
Modified: 2007-12-12 05:14 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Fusier CLA 2007-12-06 06:57:35 EST
Since the beginning, PossibleMatchSet.add(PossibleMatch) method uses a map of ObjectVector. Before adding the given possible match to the map, it verifies whether it has been already stored or not. For this, it uses the contains(Object) method of ObjectVector which seek all elements in a linear manner.

Usually it should not matter, but when there's a huge number of possible matches (typically for common method/field name search - see bug 102279), it may be a good idea to use an HashSet to decrease the time spent to make this verification.

I opened a specific bug instead of including this improvement in bug 102279 fix as this may be not enough to completely address the problem noticed in that bug.
Comment 1 Frederic Fusier CLA 2007-12-07 09:34:09 EST
I've tracked down FullSourceWorkspaceSearctTests.testPerfMethod() with yourkit and saw that there's only 360 calls to PossibleMatchSet.add() method for around 1,300 matches found. The time ratio spent in this method reagrding to the search request whole time is only about 0.02% (15ms / 65s) which is definitely negligible and make any improvement absolutely unnecessary...
Comment 2 David Audel CLA 2007-12-12 05:14:33 EST
Verified for 3.4M4.