Skip to content

Conversation

@pranavbabu
Copy link
Contributor

Cached the currency symbol regex in Parser to avoid recompiling it on every parse call, improving performance during repeated monetary parsing operations.

Benchmarking currency_symbol_regex creation...
                                user     system      total        real
Dynamic regex generation:   0.551297   0.001920   0.553217 (  0.553221)
Cached regex reuse:         0.003189   0.000083   0.003272 (  0.003271)

Co-authored-by: Sunny Ripert <sunny@sunfox.org>
Copy link
Member

@yukideluxe yukideluxe left a comment

Choose a reason for hiding this comment

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

Could we just remove the method and just use the constant here?

match = input.match(currency_symbol_regex)
😊

@yukideluxe
Copy link
Member

also, I think the test failure is related 🙏🏻

Copy link
Member

@yukideluxe yukideluxe left a comment

Choose a reason for hiding this comment

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

thanks!

@yukideluxe yukideluxe merged commit 549ace4 into RubyMoney:main Jul 23, 2025
7 checks passed
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.

3 participants