perf: faster HashMap with TypeId keys#259
perf: faster HashMap with TypeId keys#259Purpzie wants to merge 1 commit intomlua-rs:masterfrom Purpzie:userdata-perf
Conversation
|
relevant: rust-lang/rust#10389 |
|
@SoniEx2 There doesn't seem to be a way to avoid that in the first place, since it's a problem in the compiler itself. |
|
the point is "stop relying on current implementation details". like sure, use a faster hasher. but don't break if (not panicking/doing nothing in |
|
Hi @Purpzie , |
TypeIds are already hashes from the compiler, so they don't need to be hashed again. I've added a dummy hasher which just passes the TypeId through without modifying it.
For example, the
tracing-subscribercrate does the same thing: https://github.com/tokio-rs/tracing/blob/3517552c319a22c108d423ca9a1675e632f616a3/tracing-subscriber/src/registry/extensions.rs#L12-L34