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

Performance improvement for Mustermann::AST::Translator#escape #141

Closed
wants to merge 2 commits into from

Conversation

hsbt
Copy link
Contributor

@hsbt hsbt commented Aug 20, 2024

Fix #140

see bench/uri_parser_object.rb.

Before:

h2[URI::RFC2396_Parser] - h1[URI::RFC2396_Parser] is 200

After:

h2[URI::RFC2396_Parser] - h1[URI::RFC2396_Parser] is 0

Comment on lines +121 to +127
def uri_parser
if defined?(URI::RFC2396_PARSER)
URI::RFC2396_PARSER
else
@uri_parser ||= URI::RFC2396_Parser.new
end
end
Copy link
Member

@dentarg dentarg Aug 23, 2024

Choose a reason for hiding this comment

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

CI require 100% coverage so we need to cover this branching in the specs

Copy link
Member

@dentarg dentarg Aug 23, 2024

Choose a reason for hiding this comment

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

If it is possible in some resonable way? I don't know. If not, can we opt-out from the coverage requirement just for this code?

Copy link
Contributor

Choose a reason for hiding this comment

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

@dentarg when defined as a constant, you get 100% coverage. You can see my PR.
#142

Copy link
Contributor

Choose a reason for hiding this comment

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

Although, I don't know where URI::RFC2396_PARSER comes from :(

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh got it. It's in the next version of Ruby.

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.

Massive performance degragation 3.0 -> 3.0.2
3 participants