Bug 102955 - Share common marker attribute values
Summary: Share common marker attribute values
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2005-07-06 18:27 EDT by John Arthorne CLA
Modified: 2005-09-30 12:29 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2005-07-06 18:27:08 EDT
Build: 3.1

I can't believe I never thought of this...

Many integer attributes of markers are the same.  In particular, task priority
is either 0, 1, or 2, and problem severity is either 0, 1, or 2.  We could save
 12-16 bytes per marker by keeping a singleton Integer pool for these common values!
Comment 1 John Arthorne CLA 2005-08-24 11:32:40 EDT
Also consider sharing Boolean instances - I have seen many callers of
IMarker.setAttributes[Object[] Object[]) where new Boolean objects are being
passed to us.  We should only ever store two instances of Boolean.
Comment 2 John Arthorne CLA 2005-09-30 12:29:24 EDT
Fix released.  On a large test case this saved about 1MB of memory
(org.eclipse.ui.ide and all pre-reqs, with all compiler warnings turned on). In
this case there are still several MB used by Integer objects associated with
markers (char start, char end, line number, marker id). It feels like there is
still room for further optimizations.