Skip to content

Conversation

@poke1024
Copy link
Contributor

I came across this while using GatherBy; without this PR, x = Range[5000]; First[Timing[GatherBy[x, OddQ]]] evaluates to 29.0664, with this PR this changes to 0.517357.

The basic problem is described in the comment in yield_choice: sub patterns that are very expensive to check are tested, even though the Blank match should be obvious.

Seems to give a very slight but measurable improvement in runtime.

master.txt

fastblank.txt

@sn6uv
Copy link
Member

sn6uv commented Oct 18, 2016

Is this valid for Flat attributes?

rocky added a commit that referenced this pull request Sep 29, 2020
Rebase of Faster leading blank patterns #625
@rocky rocky merged commit 2279db7 into mathics:master Sep 29, 2020
@rocky
Copy link
Member

rocky commented Sep 29, 2020

Is this valid for Flat attributes?

I take it this is about improving coverage or improving performance furhter, not about whether this causes a bug.

Assuming this is an overall improvement, it doesn't bother me that it isn't perfect. We can deal with perfection another time.

If this was about being buggy, let us know. Or alternatively we'll realize that and deal with it down the line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants