Skip to content

Specialized ExpressionPattern classes - #1927

Open
mmatera wants to merge 6 commits into
masterfrom
special_paths
Open

Specialized ExpressionPattern classes #1927
mmatera wants to merge 6 commits into
masterfrom
special_paths

Conversation

@mmatera

@mmatera mmatera commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This PR adds two ingredients to the Pattern refactor:

  • Simple ordered pattern rules are now implemented by FixedBlankTupleExpressionPattern and SimpleOrderedExpressionPattern, which avoid dealing with the special code for handling orderless, flat, or oneidentity attributes.
  • After loading all the Definitions, Deferred rules are resolved before starting the evaluations. With this, pattern matching is always done using the simplest pattern matching algorithm.

As motivation, this is the number of typical patterns created in the definitions object at load time:

Shape Occurences State
head[__] 746 ✅ this round
head[_] 510 ✅ this round
head[lit] (single literal atom) 275 already optimal (isliteral)
head[,] 260 ✅ this round
head[___] 211 not implemented
head[] 85 alredy optimal (isliteral, vaccum)
head[,,_] 55 ✅ this round
head[_,OptionsPattern] 47 more specific
head[_String] 45 typed
head[_List] 44 typed
head[_Integer] 29 typed
@mmatera mmatera changed the title Special paths Aug 31, 2026
@rocky

rocky commented Sep 1, 2026

Copy link
Copy Markdown
Member

Where can I see benchmarks comparing with the existing code in master?

It would be interesting to see what improvements there are with the gs (Gries-Schneider) tests and with the Rubi package.

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

Labels

None yet

2 participants