Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2091] Improve memory usage by refactoring Regex compilation #2092

Merged

Conversation

asdfghjkxd
Copy link
Contributor

Fixes #2091

Proposed commit message

Currently, Regex checking is used in conjunction with iteration. This
pattern of coding is frowned upon due to the excessive Regex pattern
compilation, causing the program to run slower and consume more
memory.

By moving the Regex pattern compilation outside of the iteration, and
by using `Matcher` objects to check if the strings match the Regex
performance, we can potentially remove this performance bottleneck.

Let's move to refactor the code and remove such instances of Regex use
in iterative loops.

Other information

N/A

@asdfghjkxd asdfghjkxd requested a review from a team January 23, 2024 09:39
Copy link
Contributor

@sopa301 sopa301 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sopa301 sopa301 requested a review from a team January 23, 2024 17:12
@ckcherry23 ckcherry23 requested a review from a team January 23, 2024 17:19
Copy link
Contributor

@gok99 gok99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough investigation and fix!
LGTM

@gok99 gok99 changed the title [#2091] Suggestions on improvement for memory performance regarding Regex matching [#2091] Improve memory usage by refactoring Regex compilation Jan 23, 2024
Copy link
Member

@MarcusTXK MarcusTXK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think you did a great job catching this issue. Nice fix!

@ckcherry23 ckcherry23 merged commit 54ba5ec into reposense:master Jan 26, 2024
10 checks passed
Copy link
Contributor

The following links are for previewing this pull request:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestions on improvement for memory performance regarding Regex matching
5 participants