Hacker News new | ask | show | jobs
by lorenzfx 1518 days ago
Does anyone have any personal experience in applying mypyc on type-hinted, but otherwise not specially optimized python code? I'm especially interested in what kind of performance speed-ups could be achieved.
3 comments

After reading the article last night. I spent the whole evening about 5 hours getting one of my DOM libraries to compile with mypyc. It's a hacky codebase with little to no type hinting. I had to rewrite a fair abit to appease mypy and in most cases just used 'Any'. It's still got runtime issues and is buggy but I got at least a 2x speed increase on rendering a single node... https://github.com/byteface/htmlx/blob/mypyc/benchmarks.md

However I was unable to compile from my mac, could only compile using linux. but that could be as I'm using older version of dev tools.

mypy compiles itself with mypyc, for about a 3.5-4x speed up. black very recently started shipping mypyc compiled binaries, for about a 2x speed up (iirc).
glyph's article goes into this case and finds a 25% speed improvement in that case.