Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 425647

Summary: Replace SlimList
Product: [RT] RAP Reporter: Ralf Sternberg <rsternberg>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 2.3   
Target Milestone: 2.3 M3   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Ralf Sternberg CLA 2014-01-14 06:33:18 EST
RWT contains a List implementation called SlimList that is "optimized for minimal memory footprint, frequent reads and infrequent writes". This list is used for storing menu items, columns, etc.

SlimList saves up to 50% of memory compared to ArrayList, but since it's only used for small numbers of elements, the savings are neglectable (< 1 KB per session for most applications). On the other hand, the CPU performance is much worse. A caliper benchmark showed that adding 500 elements to a SlimList takes 40 times (!) longer than with an ArrayList. This factor will even increase with greater numbers of items.

Hence, the performance penalty clearly outweighs the memory savings. SlimList is not suitable for bigger element counts and it is not needed for smaller ones. I suggest to replace it with a plain ArrayList.


Memory consumption (64bit Java 1.6 Oracle VM)

n = 5
SlimList: 88 B
ArrayList: 136 B  (factor 1.55)

n = 50
SlimList: 448 B
ArrayList: 520 B  (factor 1.16)

n= 500
SlimList: 5488 B
ArrayList: 4048 B  (factor 1.36)


Adding n elements to a SlimList / ArrayList

n = 5
ArrayList: 31.25 ns
SlimList: 129.11 ns  (factor 4.1)

n = 50
ArrayList: 292.55 ns
SlimList: 1629.77 ns  (factor 5.5)

n = 500  
ArrayList: 2656.13 ns
SlimList: 108900.14 ns  (factor 40)
Comment 1 Ivan Furnadjiev CLA 2014-04-16 11:18:50 EDT
Fixed with change https://git.eclipse.org/r/25039