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

Eliminate type-piracy in string #549

Merged
merged 1 commit into from
Jun 30, 2020
Merged

Eliminate type-piracy in string #549

merged 1 commit into from
Jun 30, 2020

Conversation

timholy
Copy link
Contributor

@timholy timholy commented Jun 27, 2020

Overriding behavior for a particular eltype of a container is piracy against the container. I have no particular attachment to this particular solution; perhaps you want to define a CookieRequest struct and then overload Base.show? Anyway, this seemed like the easiest approach, but I do not know how this package interacts with a wider ecosystem so this change could, for all I know, be breaking.

Deleting this method (or replacing it with a private one) eliminates approximately 250 method invalidations, mostly from Base.show_unquoted which rampantly calls string(::String, args...). It's a small enough effect that it's a little difficult to measure, but this change seems to shave about 5% off TTFP.

Overriding behavior for a particular eltype of a container is piracy
against the container.
Copy link
Member

@quinnj quinnj left a comment

Choose a reason for hiding this comment

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

No, this is basically an "internal" only method, so definitely a good change here.

@quinnj quinnj merged commit 971312f into JuliaWeb:master Jun 30, 2020
@timholy timholy deleted the teh/stringify branch June 30, 2020 21:44
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.

2 participants