Live data from Hacker News

Making Python fast – Adventures with mypyc

blog.meadsteve.dev

1–10 of 95 posts

Re: Making Python fast – Adventures with mypyc

#2
I recently experimented with using mypyc to make some of my python a little faster. I was pleasantly surprised with how well it worked for very little code change so I thought I'd share my experiences.

The blog post wanders around a little because I had to add setuptools and wheel building as my project had previously skipped this.

Re: Making Python fast – Adventures with mypyc

#5
I didn't know that you can compile individual modules with mypyc. That's very interesting since it allows a gradual adoption of the compiler, which really helps with big codebases.

Do you know if there are any requirements for which modules can be compiled? E.g. can they be imported in other modules or do they have to be a leaf in the import tree/graph ?

Re: Making Python fast – Adventures with mypyc

#7
Mind you, it still requires to have a c compiler, to be installed separately. It's very easy on linux, but a x-code install on mac, and can be fiddling on windows.

Still nice, but not like golang or rust where you have a stand alone solution.

It's an alternative to nuitka, which I recommend to try out.

Re: Making Python fast – Adventures with mypyc

#8
Is anyone else using MyPyC in production and can share their experience? Did you attempt the compile it all approach, or incrementally add? What do compile times look like at scale?

Would love to buy you a coffee and hear about your experience and the challenges and benefits.

Re: Making Python fast – Adventures with mypyc

#10

mypyc is cool and all, but I can't help thinking about how Node just JITs everything automatically without the need for any special steps like this.

That's not Node - that's V8. And it's possible to do the same thing for Python - there's nothing magic about JavaScript compared to Python - it's just a lot of engineering work to do it, which is beyond what this project's scope is. PyPy does it, but not inside standard Python.
Post reply on HN