harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jimmy, Jing Lv (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-5056) [classlib][logging]LogManager.addLogger can improve performance
Date Thu, 01 Nov 2007 10:34:51 GMT
[classlib][logging]LogManager.addLogger can improve performance
---------------------------------------------------------------

                 Key: HARMONY-5056
                 URL: https://issues.apache.org/jira/browse/HARMONY-5056
             Project: Harmony
          Issue Type: Improvement
          Components: Classlib
            Reporter: Jimmy, Jing Lv
            Assignee: Jimmy, Jing Lv


LogManager.addLogger call addToFamilyTree to find parent and children. Currently it search
all loggers to find children, it can be improved a lot if we only search some necessary loggers(loggers
that have the new logger's parent).
A micro benchmark here:

public void test_addLogger() throws Exception {
        LogManager lm = LogManager.getLogManager();
        long start = System.currentTimeMillis();
        for (int p = 0; p < 10; p++) {
            for (int u = 0; u < 13; u++) {
                for (int j = 13; j > 0; j--) {
                    char[] name = new char[j*2];
                    for (int k = 0; k < j; k++) {
                        name[2*k]=(char)((int)'a'+u+k);
                        name[2*k+1]='.';
                    }
                    for (int i = 'a';i<'z';i++){
                        name[2*j-1]=(char)i;
                        lm.addLogger(Logger.getLogger(String.valueOf(name)));
                    }
                }
            }
            lm.addLogger(Logger.getLogger(""));
        }
        long end = System.currentTimeMillis();
        System.out.println("Time:"+ (end - start));
    }

Apply the new algorithm, it may saved 85% time (4.8sec -> 0.7 sec, on windows xp sp2).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message