mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
TLDR: Was looking at some performance traces and saw that we need to cache the result of this value. ---- Specifically, I noticed that we were spending a lot of time computing this operation. When I looked at the code I saw that we already had a cache along the relevant code paths... but the cache was from equivalence class representative -> state. Before we hit that cache, we were performing the work to map the value to the equivalence class representative... so the work to perform the relevant lookup from value -> state (which goes through the equivalence class representative) was not just a hash table lookup. This operation makes it cheaper by making it two cache lookups. It may be possible to make this cheaper by redoing the actual mapping of information so that we can go straight from value to state. I think it would be slightly different since we would probably need to represent the state in a separate array and map with indices... which is really just a more efficient hash table. We could also use malloc/etc but lets not even talk about that. rdar://139520959
20 KiB
20 KiB