John Lam 1997 — 2026

Alignment issues

Intel works in mysterious ways.

While I was measuring relative performance of VMD vs. IMD, there was something that I neglected to inform you in my previous entries: I wasn’t getting consistent results. I was running into LOTS of Heisenberg effects that I didn’t tell you about. For example, the only way for me to break into JIT-compiled code at runtime was to insert an explicit call to DebugBreak(). This would, of course, generate a 5 byte x86 call instruction, and would upset the alignment of other instructions in the vicinity.

To get around the Heisenberg effects, I decided to create a model system using inline assembler in VC++. This way, I would control the x86 code that was generated, and I could insert x86 nop instructions at my leisure to screw around with the instruction alignment of the generated code.

Raw results:

without the NOP instruction in place:

IMD = 0.85s, VMD = 0.75s

with NOP instruction in place:

IMD = .72s, VMD = 0.63s.