Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static message instead of function call to prevent shell slowdown #11933

merged 3 commits into from Nov 13, 2019
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -380,6 +380,16 @@ def _extra_prompt_options(self):
def get_message():
return PygmentsTokens(self.prompts.in_prompt_tokens())

if self.editing_mode == 'emacs':
# with emacs mode the prompt is (usually) static, so we call only
# the function once. With VI mode it can toggle between [ins] and
# [nor] so we can't precompute.
# here I'm going to favor the default keybinding which almost
# everybody uses to decrease CPU usage.
# if we have issues with users with custom Prompts we can see how to
# work around this.
get_message = get_message()

return {
'complete_in_thread': False,
@@ -0,0 +1,14 @@
Prompt Rendering Performance improvements

Pull Request :ghpull:`11933` introduced an optimisation in the prompt rendering
logic that should decrease the resource usage of IPython when using the
_default_ configuration but could potentially introduce a regression of
functionalities if you are using a custom prompt.

We know assume if you haven't changed the default keybindings that the prompt
**will not change** during the duration of your input – which is for example
not true when using vi insert mode that switches between `[ins]` and `[nor]`
for the current mode.

If you are experiencing any issue let us know.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.