Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issues #244

Open
fanhongli opened this issue Jun 26, 2017 · 4 comments
Open

Performance issues #244

fanhongli opened this issue Jun 26, 2017 · 4 comments

Comments

@fanhongli
Copy link

fanhongli commented Jun 26, 2017

log4j.rootLogger=info,log

testLoggableTime(20, 20, 1000000): in 851.02ms
testNologTime(20, 20, 1000000): in 7.46ms
@Loggable(Loggable.DEBUG)
    public double power(int x, int p) {
        return Math.pow(x, p);
    }
    
     public double nologPower(int x, int p) {
        return Math.pow(x, p);
    }

    @Loggable(Loggable.INFO)
    public void testLoggableTime(int x, int p, int times) {
        for (int i = 0; i < times; i++) {
            power(x, p);
        }
    }

    @Loggable(Loggable.INFO)
    public void testNologTime(int x, int p, int times) {
        for (int i = 0; i < times; i++) {
            nologPower(x, p);
        }

result:

testLoggableTime(20, 20, 1000000): in 851.02ms
testNologTime(20, 20, 1000000): in 7.46ms
@0crat
Copy link

0crat commented Jun 26, 2017

@yegor256 please, pay attention to this issue

@fanhongli
Copy link
Author

oh , no , the log4j2 is Worse

testLoggableTime(20, 20, 1000000): in 2.96s
testNologTime(20, 20, 1000000): in 7.55ms

is the have to use asyn ?

@fanhongli
Copy link
Author

fanhongli commented Jun 26, 2017

public double testLog4j(int x, int p, int times) {
        double ret = 0;
        for (int i = 0; i < times; i++) {
            if (log.isDebugEnabled()) {
                log.debug(" x ");
            }
            ret = Math.pow(x, p);
        }
        return ret;
    }

21.170406ms

@yegor256
Copy link
Member

@fanhongli I didn't get the problem. Can you explain again what are you comparing with what and how can we fix it?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants