4 ms·
I've also seen some tricks like stripping docstrings from the release since those strings (hopefully) aren't used in production.
by ublaze 6y ago
I've also seen some tricks like stripping docstrings from the release since those strings (hopefully) aren't used in production.
- itamarst 6y agoI can't imagine that has any significant impact on memory usage, at least for normal multi-GB-RAM servers: the docstrings will only be loaded once.
- tomwojcik 6y agoThat's nothing. Armin Ronacher was complaining somewhere about the performance hit from static typing in python and i never though about that before. It'd be best if all of that was removed in prod build along with unused imports, kind of what TypeScript does.
- ublaze 6y agoimports can't be safely automatically stripped in Python (or even 100% safely re-ordered) since they could have side effects. We run a linter that confirms with the user before stripping them, which works out well in practice.
- aitchnyu 6y agoIts apparently true for RPython too, where side effects which cause "methods and other class attributes do not change after startup".
- aaronbwebber 6y agolike PEP484 type annotations having a runtime performance hit? I would be very interested in seeing a link to this if you can dig it up.
- orf 6y agoThere used to be a performance hit because the annotation objects where all instantiated and attached to the function objects. This is no longer the case - they are only instantiated when inspected.