You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect a DEBUG trap to have some minor performance impact that largely doesn't matter for an interactive shell.
Current Behavior
Using the below contrived example, which started as troubleshooting a parameter substitution performance issue:
Five seconds with blank trap
Fifteen seconds with : (no-op) trap
Five minutes with __bp_preexec_invoke_exec function!
Honestly, doubling performance cost of every simple command would be acceptable and I wouldn't notice. But, it seems that having any DEBUG trap in Bash causes a simple echo to triple in cost. A nontrivial function for the trap? bananas.
Possible Solution
Handle setting/unsetting the DEBUG trap only when $preexec_functions has contents?
Aggressively optimize performance of trap function?
Context
I was debugging a string handling performance issue and accidentally tested the DEBUG trap and...wow...
Yes, I'll alsö be submitting an issue upstream! There have been numerous complaints of minor performance issues with Bash It and this may be related, so we should at least track it if not do something in Bash It to ameliorate the impact.
Of course, besides contrived examples it may not really impact interactive performance anyway. I need to test more.
Expected Behavior
I expect a DEBUG trap to have some minor performance impact that largely doesn't matter for an interactive shell.
Current Behavior
Using the below contrived example, which started as troubleshooting a parameter substitution performance issue:
:
(no-op) trap__bp_preexec_invoke_exec
function!Honestly, doubling performance cost of every simple command would be acceptable and I wouldn't notice. But, it seems that having any DEBUG trap in Bash causes a simple
echo
to triple in cost. A nontrivial function for the trap? bananas.Possible Solution
$preexec_functions
has contents?Context
I was debugging a string handling performance issue and accidentally tested the DEBUG trap and...wow...
Steps to Reproduce
Your Environment
The text was updated successfully, but these errors were encountered: