-
Notifications
You must be signed in to change notification settings - Fork 400
QuantityValue implemented as a fractional number 🐲 #1544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- IQuantity interfaces optimized (some methods refactored as extensions) - QuantityInfo/UnitInfo hierachy re-implemented (same properties, different constructors) - QuantityInfoLookup is now public - UntAbbreviationsCache, UnitParser, QuantityParser optimized - UnitConverter: re-implemented (multiple versions) - removed the IConvertible interface - updated the JsonNet converters - introducing the SystemTextJson project - added a new UnitsNetConfiguration to the Samples project showcasing the new configuration options - many more tests and benchmarks (perhaps too many)
@angularsen Clearly, I don't expect this to get merged in the Gitty up! fashion, but at least we have the whole picture, with sources that I can reference. If you want, send me an e-mail, we could do a quick walk-through / discussion. |
…lection constructors with IEnumerable - `UnitAbbreviationsCacheInitializationBenchmarks`: replaced some obsolete usages
I tried to create this PR twice before (many months ago), while the changes to the unit definitions were still not merged- and the web interface was giving me an error when trying to browse the files changed.. Something like "Too many files to display" 😄 |
Ok, I'm not going to get through a review of this many files anytime soon. On the surface though, it seems like this could be split up into chunks. I know it's tedious and extra work, but it will be way faster to review. Do you see any chunks of changes to easily split off into separate PRs? |
Sofia (GMT+3), but time zones are not relevant to my sleep schedule - so basically any time you want.
Yes, I do have some ideas:
Hopefully by the time we get to 5) you'd be up to speed (and fed up with PRs) and we can turn back to reviewing / working on the rest of it as a whole 😄 |
Ok, sounds good. Just send PRs my way and I'll try to get to them. I have a little bit of extra time this weekend. |
…ions into their own folder
- UnitAbbreviationsCache: removing the obsolete overload - adding a few more tests
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This PR was automatically closed due to inactivity. |
…ramework (net8.0) with 9.0 on the QuantityInfoBenchmarks
…of the official nugget version: 6.0.0-pre017)
@angularsen FYI - I'm keeping the nugget version in this PR one step ahead of the official pre-release version so that the nugget references in the Samples projects pick up the right one (same goes for my nugget sources). PS Before running the Samples, make sure you have built the Artifacts (from the global build script). |
- replaced the type of the tolerance parameter of the Equals extension with the concrete quantity type
…evant usages from the benchmarks
…l in net8+ - cleaning up some of the old benchmarks
- fix the comments for the UnitMath.Clamp
…OfType / IQuantityInstanceInfo)
@angularsen I've synced the changes from upstream, however instead of bringing down the diffs, this has added another ~200 file changes (the new I've updated the task list (completing the
... but that can only start after I've had a confirmation, that we're moving towards replacing the |
@lipchev I really like the concept of the decimal fractions, it solves equality issues and precision, and if I recall correctly it remains fairly backwards compatible. I want to say let's go, but if you could please help me out and give a short summary for a couple of things that would help a lot as I don't recall and I'm pressed for time.
|
I spent a full Sunday back in February creating a comparison chart, but before I could finish up setting up all the sheets, I accidentally executed the build script which erased all of my benchmark results. 😠 I'll attach the file as it is, but the gist is that compared to The conversions are about the same, or faster (with units other than the For example the value The initialization is slower but no more than 10x, judging from these benchmarks but that can be reduced by loading a select subset of quantities (I imagine loading just 10 PS The PS2 Aside for the static benchmarks, I've also observed a visible improvement (in the performance logs) after migrating my code-base, but that's probably due to the improvements to the string handling stuff around the
Compared to the
While inconvenient, this is the correct way to do it (implicit conversions from, and explicit conversion to any primitive number). By the way, given that in |
QuantityValue
implemented as a fractional numberIQuantity
interfaces optimized (some methods refactored as extensions)UnitInfo
: introduced two new properties:ConversionFromBase
andConversionToBase
which are used instead of theswitch(Unit)
conversionUnitsNetSetup
: introduced helper methods for adding external quantities, or re-configuring one or more of the existing onesUntAbbreviationsCache
: introduced additional factory methods (using a configuration delegate)UnitParser
: introduced additional factory methods (using a configuration delegate)UnitConverter
: re-implemented (multiple versions)Inverse
relationship mapping implemented as a type of implicit conversion