Releases: zekroTJA/timedmap
Releases · zekroTJA/timedmap
v2.0.0
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
v1.5.1
v1.4.0
-
Add
SetExpires
method to matchSection
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 useSetExpires
instead. -
Make use of
sync.Pool
to re-useelement
instances instead of creating new ones on each new element creation and passing them to the GC after deletion. -
Add
StartCleanerInternal
andStartCleanerExternal
endpoints to be able to re-start the internal cleanup loop with new specifications.