Bug 90636 - MessageResourceBundle load can be optimized
Summary: MessageResourceBundle load can be optimized
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2005-04-07 11:46 EDT by John Arthorne CLA
Modified: 2005-04-11 18:20 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 John Arthorne CLA 2005-04-07 11:46:35 EDT
Build: 3.1 M6

After loading all properties files, MessageResourceBundle iterates over all
Fields in the message key class, and does:

if (field.get(clazz) == null)
  field.set(null, "Unused message...");

The reflective get() calls are unneccesary in the common case where the field
value is already assigned. This should be optimized.
Comment 1 John Arthorne CLA 2005-04-07 12:07:33 EDT
Fix released.  I now assign a special "ASSIGNED" placeholder value in the field
map after each field has been assigned.  Now, to check if a field is unassigned,
I simply get the value in the field map and check if it is the "ASSIGNED"
placeholder.  This is much faster than a reflective field access.
Comment 2 Tod Creasey CLA 2005-04-11 10:16:54 EDT
John can you give me some numbers to report?
Comment 3 John Arthorne CLA 2005-04-11 18:20:02 EDT
The optimization on load time is hard to measure because it was already pretty
fast on individual bundles.  I wouldn't bother reporting any numbers there.  

I have also heavily optimized the NLS#bind methods.  See bug 90803 comment 17
for performance numbers (generally 160% faster to bind messages than in 3.0).