ekzhang / crepe

Datalog compiler embedded in Rust as a procedural macro
Apache License 2.0
460 stars 16 forks source link

Add a collatz conjecture benchmark #19

Closed ljedrz closed 2 years ago

ljedrz commented 2 years ago

Doubles as a straightforward example.

Note: the benchmark values are not random; they are the values with the largest stopping time in their range; citing Wikipedia:

The starting value having the largest total stopping time while being less than 10 is 9, which has 19 steps, (...) less than 10^5 is 77031, which has 350 steps, (...) less than 10^10 is 9780657630, which has 1132 steps,

ekzhang commented 2 years ago

Great! This is a cool example. Here's the output on my computer, it's about linear as we'd expect.

image

Thanks for the contribution.