Repository navigation
Conversation
- Add IArray2dExt.SequenceEqualNullable, which compares the size and then each cell - The IEnumerable overload enumerated each cell as a boxed IKeyValue and compared it through ValueType.Equals - Comparing a landscape's 33x33 heights, normals and colors takes 7.3 µs instead of 241 µs, and allocates nothing instead of 654 KB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
IReadOnlyArray2d<T>is anIEnumerable<IKeyValue<P2Int, T>>, soSequenceEqualNullableon two arrays goes through theIEnumerableoverload: every cell is boxed as anIKeyValueand compared throughValueType.Equals. Mutagen's generatedEqualsdoes exactly this for fields like a landscape's heights, normals and colors.This adds an
IReadOnlyArray2d<T>overload that compares the size, then each cell withEqualityComparer<T>.Default. Since it is more specific, existing callers pick it up when they are recompiled, without any change on their side.Comparing a landscape's three 33x33 arrays: