Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9667

Tweak ManagedIdentityConcurrentMap for better performance

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.0-alpha-1
    • 4.0.0-alpha-1
    • None
    • None

    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:

      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
      

      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.
      ManagedIdentityConcurrentMap is introduced since 4.0.0.
      ConcurrentIdentityHashMap is written by Doug Lea too.

      Attachments

        Activity

          People

            daniel_sun Daniel Sun
            daniel_sun Daniel Sun
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m