Skip to content

Commit 5b54bfd

Browse files
⚡️ 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.
1 parent 3cab8ea commit 5b54bfd

File tree

1 file changed

+113
-247
lines changed

1 file changed

+113
-247
lines changed

0 commit comments

Comments
 (0)