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

Minimize and speed up the Collatz conjecture bench #20

Merged
merged 1 commit into from Mar 2, 2022

Conversation

ljedrz
Copy link
Contributor

@ljedrz ljedrz commented Mar 2, 2022

Now that I've had a bit more time to tinker with crepe, I was able to minimize the Collatz conjecture benchmark which, in my opinion, makes it a lot more clear. This also made it a lot faster:

collatz/9               time:   [2.2401 us 2.2420 us 2.2440 us]                       
                        change: [-50.991% -50.896% -50.813%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  4 (4.00%) low mild
  5 (5.00%) high mild
  3 (3.00%) high severe
collatz/77031           time:   [37.722 us 37.743 us 37.765 us]                           
                        change: [-47.089% -46.975% -46.839%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  2 (2.00%) high mild
  3 (3.00%) high severe
collatz/9780657630      time:   [125.33 us 125.67 us 125.96 us]                               
                        change: [-50.623% -50.390% -50.161%] (p = 0.00 < 0.05)
                        Performance has improved.

Signed-off-by: ljedrz <ljedrz@gmail.com>
@@ -6,15 +6,12 @@ crepe! {
@input
struct Start(u128);
Copy link

Choose a reason for hiding this comment

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

While we're here can you indent this to match the above '@input'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to adjust the indentation, but how exactly? This is the same indentation as in the readme and in the other benchmark, with 4 spaces both before @input and struct 🤔.

@@ -6,15 +6,12 @@ crepe! {
@input
struct Start(u128);

struct Intermediate(u128, u128);

@output
struct Col(u128);
Copy link

Choose a reason for hiding this comment

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

Same here

@ekzhang
Copy link
Owner

ekzhang commented Mar 2, 2022

Nice!! Cool to see that in both cases, the asymptotic time complexity appears to be the same (all are around -50%). I think this means the semi-naive evaluation is probably working.

@ekzhang ekzhang merged commit 548f11c into ekzhang:master Mar 2, 2022
@ljedrz ljedrz deleted the bench_improve_collatz branch March 2, 2022 22:37
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.

None yet

3 participants