Last updated
Was this helpful?
Last updated
Was this helpful?
This fairly abstract version does caching and filtering to reduce the number of values it needs to check and moves calculations out of the hot loop, but is still interminably slow... even for just up to 1,000,000.
All is not lost, however. Through the use of gradual typing, Raku scales down as well as up, so this jit-friendly version is performant enough to brute force the larger calculation:
Which is better, but is still pretty slow.
The biggest gains are often from choosing the right algorithm.