[ https://issues.apache.org/jira/browse/RATIS-749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Attila Doroszlai updated RATIS-749: ----------------------------------- Summary: Create constant for set of not running states (was: Create constant for set of "not running" states) > Create constant for set of not running states > --------------------------------------------- > > Key: RATIS-749 > URL: https://issues.apache.org/jira/browse/RATIS-749 > Project: Ratis > Issue Type: Improvement > Components: server > Reporter: Attila Doroszlai > Priority: Minor > Labels: performance > Attachments: allocations.png > > > {{LogAppender$AppenderDaemon#isRunning}} creates a new array for varargs of > {{LifeCycle$State#isOneOf}} upon each call: > {code:title=https://github.com/apache/incubator-ratis/blob/005aa6ab0f7a9051bb4c4a47660bca29ec70aa20/ratis-server/src/main/java/org/apache/ratis/server/impl/LogAppender.java#L98-L100} > boolean isRunning() { > return !lifeCycle.getCurrentState().isOneOf(CLOSING, CLOSED, EXCEPTION); > } > {code} > This is frequently called (indirectly) from the main loop: > {code:title=https://github.com/apache/incubator-ratis/blob/005aa6ab0f7a9051bb4c4a47660bca29ec70aa20/ratis-server/src/main/java/org/apache/ratis/server/impl/LogAppender.java#L450-L451} > protected void runAppenderImpl() throws InterruptedException, IOException { > while (isAppenderRunning()) { > {code} > There should be a constant array defined with these states to reduce GC. -- This message was sent by Atlassian Jira (v8.3.4#803005)