Hi Devs,

I have done some analysis of the code and found some areas that we can
improve on performance. I have added samples found in the code.

 use of keySet iterator instead of entrySet iterator.It is efficient to use
entryset instead of using .get(key) look up.
Eg:

1.)Iterator iter = plugins.keySet().iterator();
                while (iter.hasNext()) {
                    String key = (String)iter.next();
                    if (entryPlugins.contains(key)) {
                        WeblogEntryPlugin pagePlugin =
(WeblogEntryPlugin)plugins.get(key);
                        try {
                            ret = pagePlugin.render(this, ret);
                        } catch (Throwable t) {
                            mLogger.error("ERROR from plugin: " +
pagePlugin.getName(), t);
                        }
                    }
                }


2. Invocation of new String(String) constructor

eg:
in WSSEUtilities class
result = new String(base64Encode(digest));

3.Use of Boolean constructor. We can use Boolean.valueOf() instead.

eg:
return (new Boolean(value)).booleanValue();

4. Use of String() constructor without using any argument. can use ""
instead.

eg:
private String  pageModels       = new String();


I would like to know comments so i can prepare patch for the performance
improvements.

Thanks

-- 
Shelan Perera

Home: http://www.shelan.org
Blog   : http://www.shelanlk.com
Twitter: shelan
skype  :shelan.perera
gtalk   :shelanrc

 I am the master of my fate:
 I am the captain of my soul.
         *invictus*

Reply via email to