How SlipCover works: JIT instrumentation
mainUnlike tools like Coverage.py that use Python's sys.settrace (which adds significant overhead), SlipCover uses just-in-time (JIT) instrumentation and de-instrumentation.
- Instrumentation: SlipCover modifies Python bytecodes by inserting instructions to track executed lines.
- De-instrumentation: As the program executes, SlipCover removes instrumentation that is no longer needed, allowing those parts to run at full speed.
- Python 3.12+: On Python 3.12 and newer, SlipCover utilizes the
sys.monitoringAPI instead of rewriting bytecode to collect coverage information.