-
Notifications
You must be signed in to change notification settings - Fork 182
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
Stabilize rounding to increment methods for FixedDecimal
#4578
Stabilize rounding to increment methods for FixedDecimal
#4578
Conversation
The failing action seems to be sporadic; I ran it locally without problems. |
Note: No binsize diff. Main:
PR:
|
https://github.com/unicode-org/icu4x/blob/main/docs/tutorials/c-tiny/fixeddecimal/test.c doesn't include calls to rounding functions. I think we should probably add that. |
On main:
On this branch:
🐖 |
@jedel1043 I think we can use generics to solve this and stay DRY. Sandbox example: Build it as WASM and check the output. Note that This will cause duplicated code between the increment and non-increment functions, but I think this is okay because if you care about code size you should just use either one or the other, and we know that many users don't need increments so we don't want to penalize those callers. |
Did a size comparison of all possible solutions: main -rwxr-xr-x 1 jedel users 25376 Feb 6 23:19 optim4.elf
-rwxr-xr-x 1 jedel users 14728 Feb 6 23:19 optim5.elf RoundingIncrement -rwxr-xr-x 1 jedel users 28768 Feb 6 23:27 optim4.elf
-rwxr-xr-x 1 jedel users 17656 Feb 6 23:27 optim5.elf IncrementLike -rwxr-xr-x 1 jedel users 26128 Feb 7 00:25 optim4.elf
-rwxr-xr-x 1 jedel users 15000 Feb 7 00:25 optim5.elf IncrementLike + #[inline(never)] (current) -rwxr-xr-x 1 jedel users 25648 Feb 7 00:39 optim4.elf
-rwxr-xr-x 1 jedel users 14920 Feb 7 00:39 optim5.elf Adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this change! This looks good to me now to land. After it lands we can play around a little more with the #[inline]
attributes to measure the impact.
I'm going to copy @markusicu on this PR in order to grant the stabilization review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please wait for @markusicu review as well
Notes from the API Review: @markusicu left numerous suggestions about documentation and generally the FixedDecimal API shape which we can fix in the 2.0 timeframe. I will file issues about those. However, @markusicu was happy with the shape and naming of Thanks @jedel1043! |
Follow up of #4571.