Releases: mroth/weightedrand
v2.1.0
What's Changed
As of go 1.21, global rand should no longer suffer from lock contention issues as long as rand.Seed
(which was deprecated in go1.20) is not called. [reference] This removes the primary use case for Chooser.PickSource
in this module, which was to avoid rand lock contention when using a single Choose in extremely high-throughput environments across multiple goroutines.
This update primarily updates documentation to reflect this, marking PickSource
as deprecated in favor of just using the default Pick
. The simple case will now perform just as well in that situation.
See #28 for details.
Full Changelog: v2.0.2...v2.1.0
v2.0.2
v2.0.1
What's Changed
- Minor documentation cleanup reflecting convenience changes with global rand seeding in go1.20. In short, it will now happen by default, so probably no longer advisable to nag people about it in the README and examples.
Full Changelog: v2.0.0...v2.0.1
v2.0.0
🎉 weightedrand
now utilizes generics for the container data structure to clean up the API and improve end-user ergonomics, thus typecasting is no longer required when obtaining your result, and can utilize any integer type for scores.
This requires a tiny code change if upgrading from a previous version (most likely just removing now unneeded typecasts), and manual upgrading of your import path to include the /v2
(see https://golang.cafe/blog/how-to-upgrade-to-a-major-version-in-go.html).
E.g. what used to be:
result := chooser.Pick().(type)
Can now simply be expressed as:
result := chooser.Pick()
This also means that the current version of the library requires go >= 1.18. For previous versions, you can continue to rely upon v1
of this library. The go module versioning system ensures you will not be automatically upgraded to a new major version without manual action.
What's Changed
Full Changelog: v1.0.0...v2.0.0
v1.0.0
What's Changed
Only CI and test related files, no changes to the library itself. This is a tagged v1.0.0 release to denote the finalization of this version of the API for API compatibility. This version will be preserved in the v1
branch.
A v2 release will closely follow integrating the API changes from generics in #14.
Full Changelog: v0.4.1...v1.0.0
v0.4.1
v0.4.0
Major Changes 🚧
This major release version changes the NewChooser
constructor to check for and error on edge conditions that could later cause a runtime issue during Pick. NOTE: As this changes the API signature for NewChooser
, thus you might have to adjust your code. Since we are still in pre-release semantic versioning now is the time to make these beneficial API refinements before we hit v1.0
and need to enforce stability.
// previous
func NewChooser(choices ...Choice) Chooser
// now
func NewChooser(choices ...Choice) (*Chooser, error)
All relevant documentation and examples has been updated to reflect this change.
Changelog
v0.3.1
Enhancements
The primary change in this release is an optimized internal implementation of the binary int search, replacing the Go standard library usage, resulting in a roughly ~33% further performance boost to samplings from a Chooser. 🐎
Changelog
- docs: update benchmarks in README 4cbfa90
- compbench: increase max items to 10 million 5a81164
- bench: restore comparative benches as example pkg 31ddd19
- docs: add code hint about future SIMD potential 12a8992
- perf: manually inline SortSearchWrapper usage 29d84ac
- ci: add go1.15 to test matrix f3b9ff9
- ci: add dependabot config 0230c36
- docs: simplify README example 8e20052
- docs: update README badges 6130951
- chore: change sample code b8555bc
- docs: add codecov badge to README ceb1e77
- ci: add code coverage workflow 09c370f
- ci: enable race detector 48e5705
v0.3.0
New Features
🎲 The major new feature introduced in this version is the PickSource()
method, which allows for utilizing a single Chooser in parallel across multiple goroutines while avoiding rand lock contention, thus allowing linearly scaling performance across CPU cores. For more details, see PR #2.
Changelog
v0.2.2
Changelog
Features:
- NewChoice convenience constructor 6e178c3
Chores:
- docs: add emoji to readme title 9bd1710
- docs: add high-level example to godocs ea41bb4
- chore: move example program into examples subdir d89c080
- chore: remove files handled by default community health 73d3c1e
- chore: rename test action f887590
- ci: update action/setup-go to v2 88d7bfe
- ci: update checkout action 81aa22d
- ci: add go 1.14.x to test matrix 77de7f2