[Java.Interop.Tools.Cecil] Unroll TypeDefinitionRocks iterators. #1244
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make a few small performance related changes to
TypeDefinitionRocks
:TypeDefinitionRocks.Get[TypeAnd]BaseTypes
provides a convenient API to work with, however it creates an iterator method and related generated infrastructure code, which causes a small amount of overhead. For performance sensitive hot paths, do the looping through base types at the call site instead.This change provides a minor (3.5ms) speedup on the test case of calling
HasJavaPeer
on every type inMono.Android
, but we call these paths enough that it might add up.Change
TypeDefinitionRocks.HasJavaPeer
to always exit immediately if the type is aninterface
, as an interface cannot have any of the listed base types.Create
IsSubclassOfAny
andImplementsAnyInterface
method variants that can replace patterns where we iterate through base types or interfaces multiple times looking for multiple values.