Skip to content

Releases: zekroTJA/timedmap

v2.0.0

04 May 12:36
0f4ecf1
Compare
Choose a tag to compare

Changes

  • Add type parameters for the key and value type of a TimedMap and corresponding constructor functions.
  • Remove the section system for better simplicity and usability.
  • Remove deprecated SetExpire method.
  • Update documentation.
  • Update minimum required Go version to v1.19.0.

Performance

By removing the support for sections, the performance of the package has improved between 40% and 55%, depending on the use-case.

$ benchstat benchmarks/*
goos: windows
goarch: amd64
pkg: github.com/zekroTJA/timedmap
cpu: AMD Ryzen 7 5800X 8-Core Processor
                      │ benchmarks/v1.5.2.txt │        benchmarks/v2.0.0.txt        │
                      │        sec/op         │   sec/op     vs base                │
SetValues-16                      635.0n ± 6%   372.1n ± 1%  -41.40% (p=0.000 n=10)
SetGetValues-16                   713.6n ± 2%   384.9n ± 5%  -46.06% (p=0.000 n=10)
SetGetRemoveValues-16             301.8n ± 0%   133.8n ± 1%  -55.64% (p=0.000 n=10)
SetGetSameKey-16                 132.25n ± 1%   69.00n ± 1%  -47.83% (p=0.000 n=10)
geomean                           366.7n        190.7n       -48.00%

                      │ benchmarks/v1.5.2.txt │          benchmarks/v2.0.0.txt          │
                      │         B/op          │    B/op     vs base                     │
SetValues-16                       232.0 ± 6%   147.5 ± 5%   -36.42% (p=0.000 n=10)
SetGetValues-16                    257.0 ± 1%   118.0 ± 0%   -54.09% (p=0.000 n=10)
SetGetRemoveValues-16              15.50 ± 3%    0.00 ± 0%  -100.00% (p=0.000 n=10)
SetGetSameKey-16                   8.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)
geomean                            52.14                    ?                       ¹ ²
¹ summaries must be >0 to compute geomean
² ratios must be >0 to compute geomean

                      │ benchmarks/v1.5.2.txt │          benchmarks/v2.0.0.txt          │
                      │       allocs/op       │ allocs/op   vs base                     │
SetValues-16                     3.000 ± 0%     1.000 ± 0%   -66.67% (p=0.000 n=10)
SetGetValues-16                  3.000 ± 0%     1.000 ± 0%   -66.67% (p=0.000 n=10)
SetGetRemoveValues-16            1.000 ± 0%     0.000 ± 0%  -100.00% (p=0.000 n=10)
SetGetSameKey-16                 0.000 ± 0%     0.000 ± 0%         ~ (p=1.000 n=10) ¹
geomean                                     ²               ?                       ² ³
¹ all samples are equal
² summaries must be >0 to compute geomean
³ ratios must be >0 to compute geomean

v1.5.2

29 Nov 22:42
5a95c12
Compare
Choose a tag to compare

v1.5.1

25 Mar 10:58
Compare
Choose a tag to compare
  • Add FromMap constructor which can be used to create a TimedMap from an existing map with the given expiration values for each key-value pair.

v1.4.0

11 Jun 09:45
Compare
Choose a tag to compare
  • Add SetExpires method to match Section interface and match naming scheme of the other expire-related endpoints.
    → Hence, SetExpire is now deprecated and will be removed in the next version. Please use SetExpires instead.

  • Make use of sync.Pool to re-use element instances instead of creating new ones on each new element creation and passing them to the GC after deletion.

  • Add StartCleanerInternal and StartCleanerExternal endpoints to be able to re-start the internal cleanup loop with new specifications.

v1.3.1

09 Mar 09:36
Compare
Choose a tag to compare
  • Fix concurrent map read and map write panic when accessing the map concurrently while getting an existing key, which is expired at the time. [#4]