Bug 62221 - PreferenceForwarder#contains() runs in linear time of the number of preferences
Summary: PreferenceForwarder#contains() runs in linear time of the number of preferences
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: DJ Houghton CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks: 60703
  Show dependency tree
 
Reported: 2004-05-14 04:30 EDT by Christof Marti CLA
Modified: 2004-05-18 11:49 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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).