ajs / perl6-Math-Sequences

Useful mathematical sequences
Artistic License 2.0
3 stars 9 forks source link

Speedup strict-partitions... #151

Closed MasterDuke17 closed 5 years ago

MasterDuke17 commented 5 years ago

By using an explicit loop instead of the sequence operator.

On my machine, use Math::Sequences::Integer; say @A000793[^40] went from 7s before to 3s after.

AlexDaniel commented 5 years ago

Why is this not a rakudobug? How come something as simple as $x…1 can't be optimized significantly?

MasterDuke17 commented 5 years ago

It sometimes is re-written into a while, but I think maybe only in the case of literal or compile-time-known values.

AlexDaniel commented 5 years ago

Thanks! Although I advice to file a perf rakudobug too.

AlexDaniel commented 5 years ago

@MasterDuke17 this makes one of the tests fail.

The output doesn't help much:

not ok 34 - strict-partitions(10)
# Failed test 'strict-partitions(10)'
# at t/support.t6 line 51
# expected: Seq.new-consumed()
#  matcher: 'infix:<~~>'
#      got: Seq.new-consumed()
# You failed 1 test of 34

I tested it now on a commit before this PR, and all tests are OK.

MasterDuke17 commented 5 years ago

Huh, I ran the tests and it was fine. Have their been new tests since then?

Sent from my iPhone

On Jul 20, 2019, at 3:46 PM, Aleks-Daniel Jakimenko-Aleksejev notifications@github.com wrote:

@MasterDuke17 this makes one of the tests fail.

The output doesn't help much:

not ok 34 - strict-partitions(10)

Failed test 'strict-partitions(10)'

at t/support.t6 line 51

expected: Seq.new-consumed()

matcher: 'infix:<~~>'

got: Seq.new-consumed()

You failed 1 test of 34

I tested it now on a commit before this PR, and all tests are OK.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

AlexDaniel commented 5 years ago

No.