Skip to content

[lldb] Avoid unnecessary regex check in dwim-print #10267

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

Conversation

kastiglione
Copy link

@kastiglione kastiglione commented Mar 15, 2025

[lldb] Avoid unnecessary regex check in dwim-print (llvm#114608)

An (unmeasured) improvement to performance of dwim-print when used as po.

This change lifts the check for note_shown to the top of the lambda, to avoid all subsequent work when the hint has already been shown. The main effect is to avoid performing a regex match when the hint is not going to be shown.

This change also constructs the std::regex only once, by making it static.

JDevlieghere and others added 2 commits March 15, 2025 16:04
We have helpers to emit warnings and errors. Do the same thing for notes
to they stand out more.

(cherry picked from commit 79178ca)
An (unmeasured) improvement to performance of `dwim-print` when used as `po`.

This change lifts the check for `note_shown` to the top of the lambda, to avoid all subsequent work when the hint has already been shown. The main effect is to avoid performing a regex match when the hint is not going to be shown.

This change also constructs the `std::regex` only once, by making it static.

(cherry picked from commit 61efe36)
@kastiglione kastiglione requested a review from a team as a code owner March 15, 2025 23:05
@kastiglione kastiglione changed the title dl/lldb Avoid unnecessary regex check in dwim print 114608 [lldb] Avoid unnecessary regex check in dwim-print Mar 15, 2025
@kastiglione
Copy link
Author

@swift-ci test

@kastiglione
Copy link
Author

@swift-ci test windows

1 similar comment
@kastiglione
Copy link
Author

@swift-ci test windows

@kastiglione kastiglione merged commit 37f3918 into stable/20240723 Mar 17, 2025
3 checks passed
@kastiglione kastiglione deleted the dl/lldb-Avoid-unnecessary-regex-check-in-dwim-print-114608 branch March 17, 2025 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants