Commit 8a8fcd3
TCHECK-160 Reduce shrink-int allocation churn
`shrink-int` has LazySeq allocation churn that can be avoided by special casing long values.
This can have a significant impact (in allocations and in run time) because `shrink-int` is used as foundation for `choose`, which in turn is used by many generators.
For example, the following snippet:
(core/let [g (vector (not-empty string-alphanumeric) 1000 5000)]
(time
(dotimes [seed 50]
(dorun (generate g 100 seed)))))
runs ~26% faster (from 22541ms to 16741ms) and allocates ~16% less (from 15.05GB to 12.66GB) after this patch.
Measured on jdk 25 with `-Xmx512m -XX:+UseSerialGC`.1 parent 32957f2 commit 8a8fcd3
1 file changed
+27
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
205 | 220 | | |
206 | 221 | | |
207 | 222 | | |
208 | 223 | | |
209 | | - | |
| 224 | + | |
210 | 225 | | |
211 | 226 | | |
212 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
213 | 239 | | |
214 | 240 | | |
215 | 241 | | |
| |||
0 commit comments