Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312252 - AnnotatedConstructor creates a hash map even to hold one annotation, which causes considerable memory overhead.
Summary: AnnotatedConstructor creates a hash map even to hold one annotation, which ca...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: IMP (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Jurgen Vinju CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-10 09:25 EDT by Mark Hills CLA
Modified: 2014-01-09 15:04 EST (History)
3 users (show)

See Also:


Attachments
Patch to specialize Annotated Constructors for 1, 2 and 3 annotations. (19.66 KB, application/octet-stream)
2010-05-11 05:29 EDT, Jurgen Vinju CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Hills CLA 2010-05-10 09:25:51 EDT
Build Identifier: 20100218-1602

Class org.eclipse.imp.pdb.facts.impl.fast.AnnotatedConstructor uses a hashmap to store the annotations on the constructor, even in cases where there is just one annotation. If a large number of uses of this class have just one annotation, this leads to considerable memory overhead. It may work better to have a specialized version of the AnnotatedConstructor tailored to just one annotation, switching over to the current version (for arbitrary numbers of annotations) automatically when needed.

Reproducible: Always

Steps to Reproduce:
1. Run a program that creates a large number of constructors.
2. Assign a single annotation to each.
3. Watch memory usage grow.
Comment 1 Jurgen Vinju CLA 2010-05-11 05:29:05 EDT
Created attachment 167883 [details]
Patch to specialize Annotated Constructors for 1, 2 and 3 annotations.

This code was written by Mark Hills (CWI)
Comment 2 Jurgen Vinju CLA 2010-05-11 05:31:45 EDT
Applied the patch. The bug is left open, since the SharedValueFactory implementation still suffers from this problem.
Comment 3 Jurgen Vinju CLA 2010-05-11 05:37:54 EDT
The shared implementation inherits from the fast implementation, thus the bug is solved in both.