Sunday, December 5, 2010
Joy to the world
...or at least to me. I've translated my Python atmega CPU emulator and I can now officially say: Python is unbearably slow.
Pure Python naive implementation is 16 times slower than the real CPU. Pure Python with improved assembly command lookup is 4 times slower. C++ with each command invoked from Python is two times slower. And finally entire emulation loop in C++ is ... 10 times faster!
I did not expect that last difference. Just writing a Python loop around C++ slows it down by the factor of 20? This insanity!
I still intend to write extensions (such as timer subsystem) in Python, but the rule is clear: no Python in the tight loop for me.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment