backend: emit bitwise ops as native ops (test.check PRNG ~2.4x)
Profiling the test.check distribution/large-sample slowness (jolt-i5if): the hot path is the SplitMix PRNG, dominated by 64-bit mix arithmetic, and the bitwise ops (bit-and/or/xor/not, shifts) were NOT in the backend native-ops table — so (bit-xor a b) compiled to a var-deref through the variadic overlay (__bit-xor) instead of a direct call, the way +/-/* already emit. Map bit-and/or/xor/not to the Chez bitwise-and/ior/xor/not primitives (inlined to native code; a non-integer operand now errors like the JVM instead of being silently truncated) and the shifts to a direct helper call. bit-and-not stays on its overlay — its only Scheme impl is 2-arg, so a value-position arity-3 use would mis-emit. mix-64 arithmetic 2.7x faster, raw split+rand-long 2.4x, gen/vector ~1.4x. The remaining gap is the bignum-vs-native-long floor (~20x, substrate) plus the generator machinery (deftype/fn dispatch, separate). Corpus rows added for value position, bit-not, apply, and a full-64-bit unsigned shift.
This commit is contained in:
parent
b5ea06c5c2
commit
f17b68ccfe
4 changed files with 153 additions and 135 deletions
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue