Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.
/ dictpool Public archive

Memory store like map[string]interface{} with better performance when reuse memory

License

Notifications You must be signed in to change notification settings

savsgio/dictpool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Oct 23, 2022
7bf2e61 Â· Oct 23, 2022

History

83 Commits
Oct 23, 2022
Oct 9, 2018
Oct 23, 2022
Feb 17, 2021
Oct 23, 2022
Oct 23, 2022
Oct 23, 2022
Oct 23, 2022
Oct 23, 2022
Oct 23, 2022
Sep 14, 2020
Sep 14, 2020
Sep 14, 2020
Jan 5, 2020

Repository files navigation

DEPRECATED

Now the performance is no better than a map or sync.Map except that the extra memory allocations are better. So without better performance, maybe map or sync.Map are good built-in alternatives

Because of that, I decided to archive this library and end support.

Thanks so much 😉!

dictpool

Test status Go Report Card GoDev

Memory store like map[string]interface{} without extra memory allocations.

Benchmarks:

BenchmarkDict-12                           41162             28199 ns/op               0 B/op          0 allocs/op
BenchmarkStdMap-12                        117976              9195 ns/op           10506 B/op         11 allocs/op
BenchmarkSyncMap-12                        73750             15524 ns/op            3200 B/op        200 allocs/op

Benchmark with Go 1.19

Example:

d := dictpool.AcquireDict()
// d.BinarySearch = true  // Useful on big heaps

key := "foo"

d.Set(key, "Hello DictPool")

if d.Has(key){
    fmt.Println(d.Get(key))  // Output: Hello DictPool
}

d.Del(key)

dictpool.ReleaseDict(d)

About

Memory store like map[string]interface{} with better performance when reuse memory

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages