I thought this day would never come.
I started developing VizTracer in 2020, when I wanted a real tracer (not just a profiler) for Python. The first version was released Aug 5, 2020, when its name was still CodeSnap.
After 4 years, it’s on v0.17.1, with more than 5k stars on github.
Some of my friends asked me, when would you release the 1.0 version? I always said, maybe never. I created and maintained a few open source projects , and all of them are on v0.x.x. I think the starting 0 is the protective color for me — which means the project is not ready.
Feel free to use it, but don’t blame if it does not work as expected, because it’s not ready.
That’s also an excuse for me to not polish the project to a higher standard — well it’s still under development and I should just focus on features. I do have a lot of things that I wanted to change, but I have always been too lazy to finish those.
Until a few weeks ago, when I suddenly thought, okay maybe it’s time.
So I
- cleaned up the ancient C extension code to eliminate the unnecessary Python middleware
- utilized __rdtsc() for timestamp instead of a syscall to greatly reduce the overhead
- replaced the legacy sys.setprofile() mechanism with the much faster sys.monitoring when it’s available
- optimized the start time by reducing potentially unused imports
- updated the documentation to reflect the latest implementation
And finally, I think it’s ready for VizTracer to have its first v1.x release. It’s still not perfect, but I’m proud of it.
VizTracer has been the best (and probably the only working) Python tracer for a long time, and now it’s even better.
It
- visualizes your Python program execution on a timeline
- supports multi-processing, multi-thread, asyncio and PyTorch
- is super easy to use with many optional powerful features
- is faster than cProfile (and probably all the other deterministic profilers)
- works on Linux/Windows/MacOS and even for free-threaded Python
If you work on Python, but never heard of it, try it out — https://github.com/gaogaotiantian/viztracer