perf: disasm bv-slice drops dead per-instruction byte copy (formatter reads only address+text)
ober
34cbf013a98d40fa014cdd8d7383a988222a0ce7
--- a/lib/jasm/disasm.ss +++ b/lib/jasm/disasm.ss @@ -108,10 +108,12 @@ (bytevector-u8-set! bv j (+ (* hi 16) lo)) (loop (+ i 2) (+ j 1)))))))) + ;; The instruction record carries a bytes slot, but the formatter only reads + ;; address+text (format.ss) and instruction-bytes has no callers, so copying + ;; each instruction's bytes into a fresh bytevector was a dead allocation per + ;; instruction. Return #f instead of copying. (define (bv-slice bv start len) - (let ([out (make-bytevector len 0)]) - (bytevector-copy! bv start out 0 len) - out)) + #f) (define (byte->hex2 b) (let ([digits "0123456789abcdef"])