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 method AssertCleanup._transform_assert_line by 34% in PR #26 (clean_concolic_tests)
To optimize the `AssertCleanup` class, we can improve the `_transform_assert_line` method by reducing the use of regular expressions, and replacing them with more efficient string operations where possible. Where regular expressions are still necessary, we compile them once and reuse them. Here's the refactored code.
### Explanation of Changes.
1. **Regex Compilation in `__init__`**: Compiled the regular expressions in the `__init__` method to avoid recompiling them every time `_transform_assert_line` is called, improving speed.
2. **String Operations for Trailing Characters**: Replaced `re.sub` used to strip trailing commas or semicolons with simpler string operations, improving efficiency.
These improvements help in optimizing the running speed of the program while maintaining the same functionality.
0 commit comments