Skip to content

Improve performance by compiling regex once#30

Open
Hamidkarimi-h wants to merge 1 commit into
persian-tools:masterfrom
Hamidkarimi-h:patch-1
Open

Improve performance by compiling regex once#30
Hamidkarimi-h wants to merge 1 commit into
persian-tools:masterfrom
Hamidkarimi-h:patch-1

Conversation

@Hamidkarimi-h

Copy link
Copy Markdown

Summary

This pull request improves the implementation of the add() function by compiling the regular expression only once instead of on every function call.

Changes

  • Compiled the regex pattern using re.compile().
  • Simplified the replacement logic.
  • Improved code readability.

Benefits

  • Slightly better performance.
  • Cleaner and easier-to-maintain code.
  • No functional changes.

Improved the implementation by compiling the regex once and simplifying the code while preserving the existing behavior.
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.

1 participant