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
⚡️ Speed up function _pipe_segment_with_colons by 12% in PR #35 (line-profiler)
To optimize the function `_pipe_segment_with_colons` for faster execution, we can simplify the logic by reducing string concatenations and condition checks. Let's rewrite the function.
Changes made.
1. Used f-strings for simpler and potentially faster string formatting.
2. Combined the checks for `right` and `decimal` alignments to reduce redundant checks and increase branch prediction efficiency.
The core logic and return values remain the same, while the function should perform faster due to simplified string operations and fewer condition checks.
0 commit comments