Commit 8f98d9a
committed
feat(payload): adopt Probability for ValueConf::float_probability
Change `ValueConf::float_probability` from `f32` to the `Probability` alias
of `BoundedProbability<{ f32::to_bits(0.0) }>`. The `try_from` impl enforces
the finite + `[0.0, 1.0]` invariant at deserialize time; `ValueConf::new`
now takes the validated type directly. (`ValueConf::valid` already had no
finite/range check on this field, so nothing is removed there.)
The new type threads through `NumValueGenerator`'s `Constant` and `Uniform`
variants. At the two comparison sites in `<NumValueGenerator as Generator>::
generate`, `.get()` extracts the inner `f32` so RNG sequences and bit-exact
output are preserved.
Verified: `cargo test -p lading-payload` (250 pass). `cargo bench -p
lading-payload --bench dogstatsd --baseline pr1` shows ±2-6% swings across
all throughput sizes; the unrelated `cache_*` benches in `--bench block`
show similar magnitude run-to-run variance, so the delta is noise rather
than a real effect.1 parent 2905d45 commit 8f98d9a
2 files changed
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
| 116 | + | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
0 commit comments