r/ProgrammingLanguages • • Nov 21 '17

Python 3 and Firefox 57 (an observation)

[deleted] — view deleted post

13 Upvotes

13 comments sorted by

View all comments

Show parent comment

4

u/[deleted] Nov 22 '17

Woah, this is a lot more in-depth than I ever expected!

Bytestring %-formatting is a very good point that I forgot about. I've never used 2to3 (I've been writing purely Python 3 since around 3.4, and if I ever need to refactor some Python 2 codebase I prefer to just rewrite it from the ground up, since there's always going to be design mistakes that could be fixed with a full rewrite), but I can see why it was a problem in your case.

I don't have much else to add, seeing as your response addressed every doubt I could have. Enjoy this little thank-you for such a great post, and for opening my eyes to the fact that Python 3 might not always be strictly better than Py2.7.

4

u/oilshell Nov 22 '17 edited Nov 22 '17

Thanks! Glad it was helpful.

I definitely had that pent up and had to get it off my chest :) My pipe dream is to port all my code to "OPy", and significantly speed it up by changing the semantics slightly, and doing more compile-time optimization.

I've been loosely following the FAT optimizer work going on now in CPython, and while it's certainly impressive, the number and complexity of hoops you need to jump through to preserve Python semantics while speeding it up is a little crazy (the version number in every dictionary, etc.).

It feels like squeezing blood out of a stone.

While they were changing Python 3 semantics, why not make it a little more optimizable?


I'm shipping 158K lines of the Python VM with Oil right now. That is on a per-file granularity (each file is included or excluded verbatim). I'm probably only using 50% of each file, so it could be 80K lines of code. I think forking that amount of code is a challenge, but not out of the question! I would try to get rid of intobject.c / longobject.c, which is still there, as well as stringobject.c / unicodeobject.c, and use the Go-style utf-8 centric scheme. That would cut it down even more.