Skip to content

Optimize URI.append_query field access - #15741

Merged
josevalim merged 1 commit into
elixir-lang:mainfrom
preciz:optimize-uri-append-query
Aug 13, 2026
Merged

Optimize URI.append_query field access#15741
josevalim merged 1 commit into
elixir-lang:mainfrom
preciz:optimize-uri-append-query

Conversation

@preciz

@preciz preciz commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Assisted-by: Codex CLI:GPT-5.6 Sol

Bind the current query in the function head so generated code can reuse the field instead of emitting repeated dynamic access paths.

Bind the current query in the function head so generated code can reuse the field instead of emitting repeated dynamic access paths.

Assisted-by: Codex:GPT-5
@AlexGx

AlexGx commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

looks like String.ends_with?(current, "&") can be optimized to :binary.last(current) == ?/ without losing readability...

@preciz

preciz commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

looks like String.ends_with?(current, "&") can be optimized to :binary.last(current) == ?/ without losing readability...

Did you mean :binary.last(current) == ?&?

@AlexGx

AlexGx commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Did you mean :binary.last(current) == ?&?

yes, sorry for typo

@preciz

preciz commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Did you mean :binary.last(current) == ?&?

yes, sorry for typo

ok, I wanted to keep this PR simple, since that would only save 2 instructions, but there was another marginal save, if in previous function head we pattern match :query also, so maybe you can explore these in a following PR at some time

@josevalim
josevalim merged commit f67cbf1 into elixir-lang:main Aug 13, 2026
15 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants