Closed jpobst closed 2 weeks ago
Using a running hash or checksum might not be accurate enough, as the integer types we'd use for them have limited range. However, what I think might speed things up a little bit more is not using LINQ to populate the HashSet<>
instances. LINQ (even in such simple instances like here) hides a lot of overhead, a for
loop might be faster.
For the dotnet new android
case, which contains ~8500 JLO's due to Mono.Android.dll
, the entire operation takes about 5 ms, so there isn't much more performance to squeeze here. 😉
If anything, we could probably omit this step for a Debug build. It is largely just ensuring that something that "can't happen" isn't happening. It's probably safe to skip this for Debug and only do it on Release builds. But that's a bigger change...
For the
dotnet new android
case, which contains ~8500 JLO's due toMono.Android.dll
, the entire operation takes about 5 ms, so there isn't much more performance to squeeze here. 😉If anything, we could probably omit this step for a Debug build. It is largely just ensuring that something that "can't happen" isn't happening. It's probably safe to skip this for Debug and only do it on Release builds. But that's a bigger change...
Yeah, it's a good idea to omit it for Debug, the assemblies there should be identical.
One question that came up with https://github.com/dotnet/android/pull/9208 was "why
SortedSet
instead ofHashSet
"?Indeed a
HashSet
seems to be 10ms - 15ms faster to construct than theSortedSet
while taking the same ~1ms to perform theSetEquals
operation.