| Summary: | EclipseContext does unnecessary object allocations | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Stefan Mücke <s.muecke> | ||||
| Component: | Runtime | Assignee: | Project Inbox <e4.runtime-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | bokowski, ob1.eclipse, pwebster, remy.suen | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | 4.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Nice catch, thanks Stefan! Patch applied to CVS Head. |
Created attachment 173380 [details] Proposed patch for EclipseContext.dispose() EclipseContext does unnecessary object allocations. I found this problem when I wanted to create a temporary EclipseContext as follows: IEclipseContext context = EclipseContextFactory.create(); // ... set some values context.set(key, value); context.setParent(parentContext); // ... do something with the context context.dispose(); I expected that creating a context without a parent and setting some values should be a cheap operation. But, even though there are no listeners installed on the context, there is a lot of overhead when the context is changed. For example, the EclipseContext.dispose() method will always create a HashSet, an EclipseContext[]-array, and a Computation[]-array regardless of whether there are listeners.