Skip to content

Eliminate type-piracy in string#549

Merged
quinnj merged 1 commit intoJuliaWeb:masterfrom
timholy:teh/stringify
Jun 30, 2020
Merged

Eliminate type-piracy in string#549
quinnj merged 1 commit intoJuliaWeb:masterfrom
timholy:teh/stringify

Conversation

@timholy
Copy link
Copy Markdown
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
Copy Markdown
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