Skip to content
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

Add benchmark for rounding methods of FixedDecimal #4571

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

jedel1043
Copy link
Contributor

This should help determine if the *_to_increment rounding methods affect performance or not.

Preliminary Results:

group experimental stable
rounding/ceil 1.00 704.3±13.32µs 1.03 725.9±16.01µs
rounding/expand 1.00 701.9±10.50µs 1.04 728.6±7.61µs
rounding/floor 1.00 712.1±21.57µs 1.02 723.6±14.02µs
rounding/half_ceil 1.02 789.2±13.48µs 1.00 773.7±9.05µs
rounding/half_even 1.01 769.4±19.95µs 1.00 764.8±3.59µs
rounding/half_expand 1.01 778.8±9.61µs 1.00 771.2±14.97µs
rounding/half_floor 1.01 782.9±19.59µs 1.00 772.9±13.17µs
rounding/half_trunc 1.00 771.0±8.55µs 1.01 778.4±14.95µs
rounding/trunc 1.00 696.2±13.94µs 1.02 707.0±10.35µs

@jedel1043 jedel1043 requested a review from sffc as a code owner February 1, 2024 04:48
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! The benches look good so I will merge this and then run them locally

@sffc sffc merged commit 6a96034 into unicode-org:main Feb 2, 2024
30 checks passed
@jedel1043 jedel1043 deleted the bench-roundings branch February 2, 2024 22:32
@sffc
Copy link
Member

sffc commented Feb 2, 2024

Here's what I get when enabling the experimental feature:

rounding/ceil           time:   [617.45 µs 686.12 µs 819.56 µs]
                        change: [+3.3587% +9.6679% +19.882%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 13 outliers among 100 measurements (13.00%)
  5 (5.00%) high mild
  8 (8.00%) high severe
rounding/floor          time:   [607.10 µs 609.13 µs 611.28 µs]
                        change: [-1.8892% +0.3084% +1.9135%] (p = 0.80 > 0.05)
                        No change in performance detected.
rounding/expand         time:   [585.07 µs 602.76 µs 629.84 µs]
                        change: [+0.6779% +2.6509% +5.5137%] (p = 0.01 < 0.05)
                        Change within noise threshold.
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high severe
rounding/trunc          time:   [578.42 µs 602.10 µs 634.53 µs]
                        change: [-22.226% -11.365% -2.6846%] (p = 0.03 < 0.05)
                        Performance has improved.
Found 17 outliers among 100 measurements (17.00%)
  4 (4.00%) low mild
  1 (1.00%) high mild
  12 (12.00%) high severe
rounding/half_ceil      time:   [673.07 µs 678.14 µs 683.32 µs]
                        change: [-0.6328% +0.6679% +1.6434%] (p = 0.28 > 0.05)
                        No change in performance detected.
Found 21 outliers among 100 measurements (21.00%)
  5 (5.00%) high mild
  16 (16.00%) high severe
rounding/half_floor     time:   [668.83 µs 671.98 µs 675.82 µs]
                        change: [-2.6121% -0.2450% +1.2000%] (p = 0.85 > 0.05)
                        No change in performance detected.
Found 14 outliers among 100 measurements (14.00%)
  5 (5.00%) high mild
  9 (9.00%) high severe
rounding/half_expand    time:   [652.88 µs 655.40 µs 658.52 µs]
                        change: [+2.4361% +3.2498% +4.2415%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) high mild
  2 (2.00%) high severe
rounding/half_trunc     time:   [651.42 µs 654.50 µs 658.03 µs]
                        change: [-2.9493% +0.2538% +2.0996%] (p = 0.87 > 0.05)
                        No change in performance detected.
Found 16 outliers among 100 measurements (16.00%)
  4 (4.00%) high mild
  12 (12.00%) high severe
rounding/half_even      time:   [655.03 µs 671.18 µs 701.62 µs]
                        change: [-20.326% -8.5595% +1.1597%] (p = 0.20 > 0.05)
                        No change in performance detected.
Found 14 outliers among 100 measurements (14.00%)
  4 (4.00%) high mild
  10 (10.00%) high severe

Some a bit faster, some a bit slower, most in the noise.

I'm happy enough with these results to move forward with a single code path (with rounding increment) and deleting the old code path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants