-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
treat String as immutable in ===
. part of #22193
#22954
Conversation
@@ -186,6 +192,13 @@ static uintptr_t jl_object_id_(jl_value_t *tv, jl_value_t *v) | |||
#else | |||
if (v == jl_ANY_flag) return 0x8ee30bdd; | |||
#endif | |||
if (dt == jl_string_type) { | |||
#ifdef _P64 | |||
return memhash_seed(jl_string_data(v), jl_string_len(v), 0xedc3b677); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these be different lengths 32 vs 64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For whatever reason, both functions take a uint32 seed.
aa6c3d0
to
6a3a308
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Surprisingly small, simple change.
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan |
Nanosoldier's table reproduced with formatting fixed:
|
This is potentially unsafe if somebody assumes that
ismutable(a) && a === b
impliespointer(a) == pointer(b)
. Hopefully in contexts where that matters you would just look atpointer(a)
directly.