Commit Graph

6 Commits

Author SHA1 Message Date
Mike Spreitzer 5d4804815d Less demanding test cases in TestUniformDistribution
Also a bug fix in the evaluation.

Kubernetes-commit: 1f1e8e21d81c4ff75078adc163bf2872d1b4650e
2021-01-25 01:44:08 -05:00
Ken Sipe 0da065589a fix S1023 redundant return statement
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: 1d795002919675b8cf3bf462b6543fef843b5b54
2020-06-25 17:29:42 -05:00
Ken Sipe b60943f03a fix S1019 use of make
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: a4d05d51d95d30ebe90ec8f652c9a794caa44d53
2020-06-25 17:26:42 -05:00
Bruce Ma 87c35dc179 address some comments
Clean up useless functions, only keep the basic function Deal
and the function DealIntoHand which will be used by Priority
and Fairness.

Improve some comments for constants and functions.

Introduce Dealer to combine parameters and methods into a whole.

Use fixed-size slice to improve performance.

Use math.Ceil and math.Log2 to calculate required entropy bits.

Make the given hand adaptive to handSize in DealIntoHand.

Signed-off-by: Bruce Ma <brucema19901024@gmail.com>

Kubernetes-commit: 7a3ca070cdd9804a22bf5db8a99576b09fc52484
2019-10-11 20:06:31 +08:00
Mike Spreitzer a74f0d114b More work on shuffle sharding utils
Changes following up on shuffle sharding util package.

Made the validation checking function return a slice of error messages
rather than just a bit.

Replaced all the `int32` with `int` because this is intended for more
than just the priority-and-faireness feature and so should not be a
slave to its configuration datatypes.

Introduced ShuffleAndDealIntoHand, to make memory allocation the
caller's problem/privilege.

Made the hand uniformity tester avoid reflection, evaluate the
histogram against the expected range of counts, and run multiple test
cases, including one in which the number of hash values is a power of
two with four extra bits (as the validation check requires) and one in
which the deck size is not a power of two.

Kubernetes-commit: da0b647155912c6b1e6b971aa5685768915d810d
2019-08-08 14:53:40 -04:00
Bruce Ma bd6349fddb Add shuffle sharding utils and tests
Implement several shuffle sharding functions including ShuffleAndDeal,
ShuffleAndDealToSlice.

Add benchmarks and tests for shuffle sharding to test performance,
correctness and distribution uniformity.

Signed-off-by: Bruce Ma <brucema19901024@gmail.com>

Kubernetes-commit: e97eaef4f65ec2cbfebf4fd9e726c9e2a6bf5499
2019-07-29 18:01:08 +08:00