Skip to content

Optimize uri normalization#4212

Merged
Gargron merged 2 commits intomastodon:masterfrom
ClearlyClaire:optimize-uri-normalization
Jul 15, 2017
Merged

Optimize uri normalization#4212
Gargron merged 2 commits intomastodon:masterfrom
ClearlyClaire:optimize-uri-normalization

Conversation

@ClearlyClaire
Copy link
Copy Markdown
Contributor

Minor optimizations out of my previous “fix-push” PR request (now obsolete) that heavily used URI normalization.
While it provided a ×5 speed-up in that situation, there should be no single task in Mastodon making such heavy use of URI normalization, so the benefits are not that obvious.
Nevertheless, URI normalization happens frequently in Mastodon, so this should contribute to reducing Mastodon's CPU usage overall.

When we are only interested in the normalized host, calling normalized_host
avoids normalizing the other components of the URI as well as creating a
new object
@ClearlyClaire ClearlyClaire added the performance Runtime performance label Jul 15, 2017
@Gargron Gargron merged commit 05cd370 into mastodon:master Jul 15, 2017
@Gargron
Copy link
Copy Markdown
Member

Gargron commented Jul 15, 2017

Note: I had to install libidn11-dev on my Ubuntu 16.04 to get ruby-idn to install.

@beatrix-bitrot
Copy link
Copy Markdown
Contributor

beatrix-bitrot commented Jul 15, 2017 via email

@ClearlyClaire ClearlyClaire deleted the optimize-uri-normalization branch October 4, 2017 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Runtime performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants