[ 
https://issues.apache.org/jira/browse/RATIS-749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16977608#comment-16977608
 ] 

Attila Doroszlai commented on RATIS-749:
----------------------------------------

[~szetszwo], thanks for checking these patches.  I have updated both based on 
your comments.

> 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: RATIS-749.001.patch, RATIS-749.001b.patch, 
> RATIS-749.002.patch, RATIS-749.002b.patch, 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)

Reply via email to