You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Julio A Pérez Duarte (JIRA)" <ji...@apache.org> on 2018/07/13 04:21:00 UTC

[jira] [Updated] (HTTPCORE-535) mod workerCount is power of two can be improved as &(workerCount-1)

     [ https://issues.apache.org/jira/browse/HTTPCORE-535?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julio A Pérez Duarte updated HTTPCORE-535:
------------------------------------------
    Attachment: myportfolio-financial-planning-tool1.png

> mod workerCount is power of two  can be improved as &(workerCount-1)
> --------------------------------------------------------------------
>
>                 Key: HTTPCORE-535
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-535
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore NIO
>            Reporter: silver9886
>            Priority: Critical
>         Attachments: myportfolio-financial-planning-tool1.png
>
>
> if workerCount is power of two . improve 
> final int i = Math.abs(currentWorker.incrementAndGet() % workerCount);
> to be 
> final int i = Math.abs(currentWorker.incrementAndGet() & (workerCount-1) );



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org