Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Logger/string formatting slows down some calculations #789

Copy link
Copy link
@biocryst

Description

@biocryst
Issue body actions

Calculating secondary structure of 4hhb 10000 times takes 589 seconds on my machine. If the following two lines are commented out, it takes 34 seconds:

logger.debug(" cccc: " + one.getResidueNumber() +
" " + one.getPDBName() + " " +two.getResidueNumber()+
" " + two.getPDBName() + String.format(" O ("+
O.getPDBserial()+")..N ("+ N.getPDBserial()+
"):%4.1f | ho:%4.1f - hc:%4.1f + nc:%4.1f - no:%4.1f ",
dno,dho,dhc,dnc,dno));

logger.debug(String.format(" N (%d) O(%d): %4.1f : %4.2f ",
N.getPDBserial(),O.getPDBserial(), (float) dno, energy));

The problem is likely to be in the String.format method. Using SLF4J parameterized messages instead ("{}") is much faster, but does not support float formatting to number of decimal places (see https://stackoverflow.com/questions/22720865/formatting-floating-point-numbers-in-slf4j, thanks @josemduarte ).

My suggestion is to go through the logging messages which use string formatting and, if feasible, change them to parameterized messages.

The performance is noticeably affected only if the logging statements are somewhere deep within a loop.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs and bugfixesBugs and bugfixesenhancementImprovement of existing code or methodImprovement of existing code or method

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.