You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (Jira)" <ji...@apache.org> on 2020/07/31 04:42:00 UTC

[jira] [Updated] (GROOVY-9667) Tweak ManagedIdentityConcurrentMap for better performance

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

Daniel Sun updated GROOVY-9667:
-------------------------------
    Description: 
Here is the benchmark project to test the performance of concurrent maps ( https://github.com/danielsun1106/benchmark-concurrentmaps )

The result generated on my local machine:
{code:java}
Benchmark                                                 Mode  Cnt    Score    Error   Units
ConcurrentMapBench.testConcurrentIdentityHashMap_get     thrpt   15  176.293 ± 14.399  ops/ms
ConcurrentMapBench.testConcurrentIdentityHashMap_put     thrpt   15   11.263 ±  8.088  ops/ms
ConcurrentMapBench.testConcurrentReferenceHashMap_get    thrpt   15  197.955 ± 12.753  ops/ms
ConcurrentMapBench.testConcurrentReferenceHashMap_put    thrpt   15  194.053 ±  4.108  ops/ms
ConcurrentMapBench.testManagedConcurrentMap_get          thrpt   15  154.559 ±  5.860  ops/ms
ConcurrentMapBench.testManagedConcurrentMap_put          thrpt   15   10.226 ±  9.142  ops/ms
ConcurrentMapBench.testManagedIdentityConcurrentMap_get  thrpt   15  140.041 ±  2.827  ops/ms
ConcurrentMapBench.testManagedIdentityConcurrentMap_put  thrpt   15    6.897 ±  5.559  ops/ms
{code}

According to the performance test report, {{ManagedIdentityConcurrentMap}} is as efficient as {{ManagedConcurrentMap}} when executing {{get}} method, but less efficient when executing {{put}} method.

Also, {{ConcurrentReferenceHashMap}} based on {{AbstractMap}} is more efficient than other alternatives, so {{ManagedIdentityConcurrentMap}} is polished to base on `ConcurrentReferenceHashMap` written by Doug Lea.

P.S.  {{ConcurrentIdentityHashMap}} is written by Doug Lea too.

> Tweak ManagedIdentityConcurrentMap for better performance
> ---------------------------------------------------------
>
>                 Key: GROOVY-9667
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9667
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Daniel Sun
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 4.0.0-alpha-1
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Here is the benchmark project to test the performance of concurrent maps ( https://github.com/danielsun1106/benchmark-concurrentmaps )
> The result generated on my local machine:
> {code:java}
> Benchmark                                                 Mode  Cnt    Score    Error   Units
> ConcurrentMapBench.testConcurrentIdentityHashMap_get     thrpt   15  176.293 ± 14.399  ops/ms
> ConcurrentMapBench.testConcurrentIdentityHashMap_put     thrpt   15   11.263 ±  8.088  ops/ms
> ConcurrentMapBench.testConcurrentReferenceHashMap_get    thrpt   15  197.955 ± 12.753  ops/ms
> ConcurrentMapBench.testConcurrentReferenceHashMap_put    thrpt   15  194.053 ±  4.108  ops/ms
> ConcurrentMapBench.testManagedConcurrentMap_get          thrpt   15  154.559 ±  5.860  ops/ms
> ConcurrentMapBench.testManagedConcurrentMap_put          thrpt   15   10.226 ±  9.142  ops/ms
> ConcurrentMapBench.testManagedIdentityConcurrentMap_get  thrpt   15  140.041 ±  2.827  ops/ms
> ConcurrentMapBench.testManagedIdentityConcurrentMap_put  thrpt   15    6.897 ±  5.559  ops/ms
> {code}
> According to the performance test report, {{ManagedIdentityConcurrentMap}} is as efficient as {{ManagedConcurrentMap}} when executing {{get}} method, but less efficient when executing {{put}} method.
> Also, {{ConcurrentReferenceHashMap}} based on {{AbstractMap}} is more efficient than other alternatives, so {{ManagedIdentityConcurrentMap}} is polished to base on `ConcurrentReferenceHashMap` written by Doug Lea.
> P.S.  {{ConcurrentIdentityHashMap}} is written by Doug Lea too.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)