Bug 62221

Summary: PreferenceForwarder#contains() runs in linear time of the number of preferences
Product: [Eclipse Project] Platform Reporter: Christof Marti <christof_marti>
Component: ResourcesAssignee: DJ Houghton <dj.houghton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Kevin_Haaland
Version: 3.0Keywords: performance
Target Milestone: 3.0 M9   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 60703    

Description Christof Marti CLA 2004-05-14 04:30:38 EDT
PreferenceForwarder#contains(String) iterates over the preference keys while
Preferences#contains(String) did a lookup in a hashtable.

This is a performance problem when opening a Java editor and takes ~8% of the
time  in I200405130800 with the performance fix from bug 61446 applied.

(I will repeat my measurements with the upcoming I-builds that will include the
above mentioned fix.)
Comment 1 Christof Marti CLA 2004-05-14 04:33:28 EDT
adding dependency and keyword
Comment 2 DJ Houghton CLA 2004-05-14 10:41:29 EDT
Aren't we supposed to release slow code in the beginning so when we do our
performance pass we look that much better? Will fix and also take out all the
Thread.sleep() class.... :-)
Comment 3 DJ Houghton CLA 2004-05-14 10:45:05 EDT
Oops... I meant to say "calls" instead of "class". man I can't even try to be
funny today.

Fixed and released to HEAD.

Thanks.

Comment 4 Christof Marti CLA 2004-05-18 06:10:11 EDT
Thanks for the quick response.

Btw., we just noted that with this change contains() no longer fails gracefully
when null is passed in as an argument. We fixed our side (see bug 62612), but
you may want to check for null to be on the safe side here.
Comment 5 DJ Houghton CLA 2004-05-18 08:45:06 EDT
Agreed. See bug 62586.
Comment 6 DJ Houghton CLA 2004-05-18 11:49:07 EDT
I also just changed #isDefault(String) which had the same performance problem as
#contains(String).