harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Zhou <zhoukevi...@gmail.com>
Subject Re: [classlib][luni] Redundant and repeated external properties loading using ResourceBundle may degrade performance.
Date Thu, 20 Nov 2008 08:21:29 GMT
Jim Yu wrote:
> In addition, using ResourceBundle in Harmony can make the message output be
> easily localized into different languages. And it is very convenient to
> support more locales in the future.
> 2008/11/20 Sean Qiu <sean.xx.qiu@gmail.com>
>> We can benefit from it when exceptions are thrown many times.
>> But we rarely encounter this situation in our application :)
>> To save the memory, space outweigh time in this case.
>> Correct me if I'm wrong.
>> 2008/11/20 Kevin Zhou <zhoukevin83@gmail.com>
>>> Hi,
>>> I read some code in LUNI module of Harmony.
>>> (org.apache.harmony.luni.util.Msg/MsgHelp and java.util.ResourceBundle)
>>> I found that Harmony uses ResourceBundle to load messages from external
>>> properties file.
>>> e.g. Once it requires a message "K0046", it will always use
>>> ResourceBundle to go through the
>>> org.apache.harmony.luni.util.ExternalMessages.properties file to search
>> it.
>>> I think such redundant and repeated I/O operations may degrade our
>>> performance.
>>> Why not use a hashtable to store all the external messages? It only
>>> requires several I/O operations initially!
>> --
>> Best Regards
>> Sean, Xiao Xia Qiu
>> China Software Development Lab, IBM
Hi Jim,
I think that you misunderstand.
I don't mean to discard using ResourceBundle for localization.
I just suggest that we should use ResourceBundle to load all the 
external properties and store them in a hashtable initially.
Then you don't need to repeat calling ResourceBundle to scan property 
files any more, but turn to the hashtable. This may improve performance.

Hi Sean and Regis,
I think that external messages are not only designed for exceptions 
Some may also use such a useful mechanism in their applications.

Let's assume that one application execute on HARMONY.
As a side effect, all jars on the bootpath will be loaded to search for 
the ResourceBundle class the first time an external message is required.
Obviously, application have to wait utill ResourceBundle class is loaded 
and it successfully finds the required message, which takes seconds.

Note that if we can initially load all of the external properties before 
the first application class is loaded.
This can provide a faster startup time and quick responses when it 
requires any external messages.

View raw message