Optimizations, Architectural Improvements and Bug Fixes #4
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.
This update makes a lot of improvements while keeping previous code intact, if not deprecated in certain places.
JsonConverter<TInput, TOutput>SpanJsonConverter<T, U>orJsonConverter<T>JsonSerializerJsonStreamSerializerThe deprecation of
JsonSerializertoJsonStreamSerializeris simply a name change. Both classes function exactly the same, but the later name better conveys the intent of the class (anIStreamSerializerfor Json serialization) and doesn't conflict with theJsonSerializerclass in theSystem.Text.Jsonnamespace. This is but a minor gripe, but a nice one to avoid.This update also deprecates the
JsonConverter<TInput, TOutput>. The HeatmapJsonConverters have been changed to inherit fromJsonConverter<T>, and the NumericJsonConverters have been changed to inherit from theSpanJsonConverter<T, U>, a very fastJsonConverter<T>for serializing a data type to, and deserializing a data type from, an array of an unmanaged type. TheSpanJsonConverter<T>allocates no extra memory serializing and deserializing the object by working directly with existing memory through the use of Spans.To unify the heatmap implementations, a new class
Counter<T>has been made and -parented toHeatmap2,Heatmap3, andHeatmap3to2. ACounter<T>is a wrapper for aDictionary<T, int>that makes it simple to count items. Heatmaps are effectively positional counters, hence can inherit from this generic class. It may also be repurposed in different scenarios.Other additions include the
BooleanExtensionsclass with a utility function for converting a boolean to an int withToInt()or a number withToNumber<T>(), setting the projects globalization to invariant for consistent functionality across different regions, and changing the license from GNU to MIT.Cheers.