Skip to content

Add an ability to prepare (compile) pattern before glob#7

Open
vasayxtx wants to merge 1 commit intoryanuber:masterfrom
vasayxtx:pattern-compilation
Open

Add an ability to prepare (compile) pattern before glob#7
vasayxtx wants to merge 1 commit intoryanuber:masterfrom
vasayxtx:pattern-compilation

Conversation

@vasayxtx
Copy link

@vasayxtx vasayxtx commented Sep 9, 2020

Thanks for this simple library. I need to test matching a lot of strings with the same pattern, so for performance reasons, it would be better to prepare the last one before.
Microbench:

$ go version
go version go1.15.1 darwin/amd64

$ go test -bench=.
goos: darwin
goarch: amd64
pkg: github.com/ryanuber/go-glob
BenchmarkGlob-8                  5427961               219 ns/op
BenchmarkCompiledGlob-8         31287264                37.4 ns/op
PASS
ok      github.com/ryanuber/go-glob     2.814s

It's needed for performance sensitive cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant