Repository navigation
Conversation
|
I've done something similar for Quart after finding it had a significant impact on micro benchmarks. Edit: The quart study was done a few years ago before the switch to ContextVars which seem significantly quicker. I still think this is a useful change, but seems less performance motivated now. |
This was added as per 0ec7f71 by mistake.
The globals have a performance penalty which can be justified for the convinience in user code. In the app however the ctx can easily be passed through the method calls thereby reducing the performance penalty. This may affect extensions if they have subclassed the app and overridden these methods.
|
My initial reaction is that while this makes sense, I'm uncomfortable with making the change. I'll have to think about this for a little bit. |
|
Could you give more information about the benchmarks? How micro are we talking; how fast does the complexity of the app overshadow any speed gains? Is the speed loss in the use of the proxy, or is the gain in the use of the local variable? Perhaps using |
|
This is an interesting one, with Quart the equivalent to this makes around a 1.5 times improvement, whereas for Flask it doesn't seem to have any affect (maybe a minor positive one). I don't think I can therefore remove it from Quart, but I'd like the APIs to match. (I tried Also I don't think this makes it more complex - without knowledge of Flask's globals it would be expected to be passed via the call chain. |
|
This will be deferred to allow further discussion. |
|
continued in #5818 |
The globals have a performance penalty which can be justified for the convinience in user code. In the app however the ctx can easily be passed through the method calls thereby reducing the performance penalty.
This may affect extensions if they have subclassed the app and overridden these methods.
Checklist:
CHANGES.rstsummarizing the change and linking to the issue... versionchanged::entries in any relevant code docs.pre-commithooks and fix any issues.pytestandtox, no tests failed.