fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

all: use grafana/regexp fork for faster regexp (#270)

grafana/regexp's speedup branch contains the stdlib regexp with multiple
patches applied to speed up regexp. The benchmark improvements are quite
impressive across the board. The series of patches are being considered
for inclusion in golang. I took a look over them, and they look legit
enough for us to start using it.

+27 -24
+1 -1
build/builder.go
··· 30 30 "path" 31 31 "path/filepath" 32 32 "reflect" 33 - "regexp" 34 33 "runtime" 35 34 "runtime/pprof" 36 35 "sort" ··· 42 41 "github.com/bmatcuk/doublestar" 43 42 "github.com/google/zoekt" 44 43 "github.com/google/zoekt/ctags" 44 + "github.com/grafana/regexp" 45 45 "github.com/rs/xid" 46 46 "gopkg.in/natefinch/lumberjack.v2" 47 47 )
+2 -3
build/e2e_test.go
··· 15 15 package build 16 16 17 17 import ( 18 + "context" 18 19 "encoding/json" 19 20 "fmt" 20 21 "io/ioutil" ··· 22 23 "os" 23 24 "path/filepath" 24 25 "reflect" 25 - "regexp" 26 26 "runtime" 27 27 "strings" 28 28 "testing" 29 29 "time" 30 30 31 - "golang.org/x/net/context" 32 - 33 31 "github.com/google/zoekt" 34 32 "github.com/google/zoekt/query" 35 33 "github.com/google/zoekt/shards" 34 + "github.com/grafana/regexp" 36 35 ) 37 36 38 37 func TestBasic(t *testing.T) {
+2 -1
cmd/zoekt-mirror-gitiles/cgit.go
··· 21 21 "log" 22 22 "net/http" 23 23 "net/url" 24 - "regexp" 25 24 "strings" 25 + 26 + "github.com/grafana/regexp" 26 27 ) 27 28 28 29 // I will go to programmer hell for trying to parse HTML with
+1 -1
cmd/zoekt-sourcegraph-indexserver/cleanup.go
··· 6 6 "os" 7 7 "os/exec" 8 8 "path/filepath" 9 - "regexp" 10 9 "sort" 11 10 "strings" 12 11 "time" 13 12 14 13 "github.com/google/zoekt" 14 + "github.com/grafana/regexp" 15 15 "github.com/prometheus/client_golang/prometheus" 16 16 "github.com/prometheus/client_golang/prometheus/promauto" 17 17 "gopkg.in/natefinch/lumberjack.v2"
+1 -1
cmd/zoekt-sourcegraph-indexserver/merge.go
··· 7 7 "os" 8 8 "os/exec" 9 9 "path/filepath" 10 - "regexp" 11 10 "strconv" 12 11 "time" 13 12 14 13 "github.com/google/zoekt" 14 + "github.com/grafana/regexp" 15 15 "github.com/prometheus/client_golang/prometheus" 16 16 "github.com/prometheus/client_golang/prometheus/promauto" 17 17 "gopkg.in/natefinch/lumberjack.v2"
+1 -1
eval.go
··· 18 18 "context" 19 19 "fmt" 20 20 "log" 21 - "regexp" 22 21 "regexp/syntax" 23 22 "sort" 24 23 "strings" 25 24 26 25 enry_data "github.com/go-enry/go-enry/v2/data" 27 26 "github.com/google/zoekt/query" 27 + "github.com/grafana/regexp" 28 28 ) 29 29 30 30 const maxUInt16 = 0xffff
+1 -1
eval_test.go
··· 18 18 "context" 19 19 "hash/fnv" 20 20 "reflect" 21 - "regexp" 22 21 "regexp/syntax" 23 22 "strings" 24 23 "testing" ··· 26 25 "github.com/RoaringBitmap/roaring" 27 26 "github.com/google/go-cmp/cmp" 28 27 "github.com/google/zoekt/query" 28 + "github.com/grafana/regexp" 29 29 ) 30 30 31 31 var opnames = map[syntax.Op]string{
+1 -1
gitindex/filter.go
··· 14 14 15 15 package gitindex 16 16 17 - import "regexp" 17 + import "github.com/grafana/regexp" 18 18 19 19 // Filter is a include/exclude filter to be used for repo names. 20 20 type Filter struct {
+1 -1
gitindex/tree_test.go
··· 24 24 "os/exec" 25 25 "path/filepath" 26 26 "reflect" 27 - "regexp" 28 27 "sort" 29 28 "testing" 30 29 "time" ··· 34 33 "github.com/google/zoekt/build" 35 34 "github.com/google/zoekt/query" 36 35 "github.com/google/zoekt/shards" 36 + "github.com/grafana/regexp" 37 37 ) 38 38 39 39 func createSubmoduleRepo(dir string) error {
+1
go.mod
··· 17 17 github.com/google/go-cmp v0.5.5 18 18 github.com/google/go-github/v27 v27.0.6 19 19 github.com/google/slothfs v0.0.0-20190417171004-6b42407d9230 20 + github.com/grafana/regexp v0.0.0-20220202152701-6a046c4caf32 20 21 github.com/hashicorp/go-hclog v0.12.1 // indirect 21 22 github.com/hashicorp/go-retryablehttp v0.6.4 22 23 github.com/keegancsmith/rpc v1.1.0
+2
go.sum
··· 273 273 github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= 274 274 github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= 275 275 github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= 276 + github.com/grafana/regexp v0.0.0-20220202152701-6a046c4caf32 h1:M3wP8Hwic62qJsiydSgXtev03d4f92uN1I52nVjRgw0= 277 + github.com/grafana/regexp v0.0.0-20220202152701-6a046c4caf32/go.mod h1:M5qHK+eWfAv8VR/265dIuEpL3fNfeC21tXXp9itM24A= 276 278 github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= 277 279 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= 278 280 github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
+2 -3
index_test.go
··· 20 20 "fmt" 21 21 "os" 22 22 "reflect" 23 - "regexp" 24 23 "regexp/syntax" 25 24 "strings" 26 25 "testing" 27 - 28 - "github.com/kylelemons/godebug/pretty" 29 26 30 27 "github.com/google/go-cmp/cmp" 31 28 "github.com/google/go-cmp/cmp/cmpopts" 32 29 "github.com/google/zoekt/query" 30 + "github.com/grafana/regexp" 31 + "github.com/kylelemons/godebug/pretty" 33 32 ) 34 33 35 34 func clearScores(r *SearchResult) {
+1 -1
matchtree.go
··· 17 17 import ( 18 18 "fmt" 19 19 "log" 20 - "regexp" 21 20 "strings" 22 21 "unicode/utf8" 23 22 24 23 "github.com/google/zoekt/query" 24 + "github.com/grafana/regexp" 25 25 ) 26 26 27 27 // A docIterator iterates over documents in order.
+1 -1
matchtree_test.go
··· 16 16 17 17 import ( 18 18 "reflect" 19 - "regexp" 20 19 "testing" 21 20 22 21 "github.com/RoaringBitmap/roaring" 23 22 "github.com/google/zoekt/query" 23 + "github.com/grafana/regexp" 24 24 ) 25 25 26 26 func Test_breakOnNewlines(t *testing.T) {
+1 -1
query/parse.go
··· 18 18 "bytes" 19 19 "fmt" 20 20 "log" 21 - "regexp" 22 21 "regexp/syntax" 23 22 24 23 "github.com/go-enry/go-enry/v2" 24 + "github.com/grafana/regexp" 25 25 ) 26 26 27 27 var _ = log.Printf
+2 -1
query/parse_test.go
··· 17 17 import ( 18 18 "log" 19 19 "reflect" 20 - "regexp" 21 20 "regexp/syntax" 22 21 "testing" 22 + 23 + "github.com/grafana/regexp" 23 24 ) 24 25 25 26 func mustParseRE(s string) *syntax.Regexp {
+1 -1
query/query.go
··· 21 21 "fmt" 22 22 "log" 23 23 "reflect" 24 - "regexp" 25 24 "regexp/syntax" 26 25 "sort" 27 26 "strconv" ··· 29 28 "sync" 30 29 31 30 "github.com/RoaringBitmap/roaring" 31 + "github.com/grafana/regexp" 32 32 ) 33 33 34 34 var _ = log.Println
+2 -1
query/query_test.go
··· 17 17 import ( 18 18 "log" 19 19 "reflect" 20 - "regexp" 21 20 "testing" 21 + 22 + "github.com/grafana/regexp" 22 23 ) 23 24 24 25 var _ = log.Println
+1 -1
shards/shards_test.go
··· 23 23 "math" 24 24 "os" 25 25 "reflect" 26 - "regexp" 27 26 "runtime" 28 27 "sort" 29 28 "strconv" ··· 37 36 "github.com/google/zoekt" 38 37 "github.com/google/zoekt/query" 39 38 "github.com/google/zoekt/stream" 39 + "github.com/grafana/regexp" 40 40 ) 41 41 42 42 type crashSearcher struct{}
+2 -3
web/server.go
··· 16 16 17 17 import ( 18 18 "bytes" 19 + "context" 19 20 "encoding/json" 20 21 "fmt" 21 22 "html/template" 22 23 "log" 23 24 "net" 24 25 "net/http" 25 - "regexp" 26 26 "regexp/syntax" 27 27 "sort" 28 28 "strconv" ··· 30 30 "sync" 31 31 "time" 32 32 33 - "golang.org/x/net/context" 34 - 35 33 "github.com/google/zoekt" 36 34 "github.com/google/zoekt/query" 37 35 "github.com/google/zoekt/rpc" 38 36 "github.com/google/zoekt/stream" 37 + "github.com/grafana/regexp" 39 38 ) 40 39 41 40 var Funcmap = template.FuncMap{