Skip to content

Commit 09e5347

Browse files
committed
Faster megular expressions (#265)
* much cheaper copies of captures * Add a benchmark * allocate to a slice. Use indexes as handles * cleanup * Add nocapture loop benchmark It's really fast. No surprise * cleanup * nits
1 parent 3342cbf commit 09e5347

5 files changed

Lines changed: 662 additions & 121 deletions

File tree

util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,6 @@ func ForEach(m Multiaddr, cb func(c Component) bool) {
124124
}
125125

126126
func (m Multiaddr) Match(p ...meg.Pattern) (bool, error) {
127-
s := meg.PatternToMatchState(p...)
128-
return meg.Match(s, m)
127+
matcher := meg.PatternToMatcher(p...)
128+
return meg.Match(matcher, m)
129129
}

0 commit comments

Comments
 (0)