[Python-Dev] Thoughts on -O (original) (raw)
Delaney, Timothy C (Timothy) tdelaney@avaya.com
Tue, 29 Apr 2003 10:10:39 +1000
- Previous message: [Python-Dev] Dictionary tuning
- Next message: [Python-Dev] Thoughts on -O
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Was doing some thinking in the shower this morning, and came up with = some ideas for specifying optimisation. These are currently quite = nebulous thoughts ...
We have the current situation:
-O only removes asserts -OO removes asserts and docstrings.
I think this is an ideal time to revisit the purpose of -O for 2.4 or = later.
IMO the "vanilla" mode should be a "release" mode. Users should not have = to use a command-line option to gain "release" optimisations such as = asserts.
I would propose that we have the following modes for python to work in.
- Release/Production mode (no command-line switch)
- asserts are turned off
- well-tested/stable optimisations are included
- possibly additional things, such as not calling trace functions
- Optimised mode (-O)
more experimental optimisations are included i.e. those that may = have performance improvements in some cases, but penalties in others, = etc
may possibly split this up so individual optimisations can be turned = on and off as required - this would leave -O by itself as a no-op
- Docstring elimination mode (-OO)
- may be specified in addition to optimised mode - it does not imply = optimised mode
- Debug mode (-D?)
- will be the slowest mode - no optimisations - cannot be called with = either -O or -OO
- turns on asserts
- turns on trace functions
I would see Debug mode being used by developers in unit tests, code = coverage, etc.
.pyc and .pyo files would need to know which optimisations they were = compiled with so that if they would be loaded again with the "wrong" = optimisations they would be re-compiled.
Anyway, any thoughts, rebuttals, etc would be of interest. I'd like to = get some discussion before I create a PEP.
Cheers.
Tim Delaney
- Previous message: [Python-Dev] Dictionary tuning
- Next message: [Python-Dev] Thoughts on -O
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]