From 2936d7acc47c6eb56cac096b436de020ca712bcf Mon Sep 17 00:00:00 2001 From: Joseph Kato Date: Fri, 13 Nov 2020 17:11:05 -0800 Subject: [PATCH] perf: use `jdkato/regexp` This makes a big difference! --- check/occurrence.go | 3 +-- core/core.go | 2 +- core/format.go | 3 ++- core/location.go | 3 ++- spell/aff.go | 3 ++- spell/gospell.go | 3 ++- spell/words.go | 3 ++- styles/plugins/Sequence.go | 2 +- ui/error.go | 2 +- 9 files changed, 14 insertions(+), 10 deletions(-) diff --git a/check/occurrence.go b/check/occurrence.go index 65ba01ff..67a3cd03 100644 --- a/check/occurrence.go +++ b/check/occurrence.go @@ -1,10 +1,9 @@ package check import ( - "regexp" - "github.com/errata-ai/vale/v2/config" "github.com/errata-ai/vale/v2/core" + "github.com/jdkato/regexp" "github.com/mitchellh/mapstructure" ) diff --git a/core/core.go b/core/core.go index 088bf384..cbed447a 100755 --- a/core/core.go +++ b/core/core.go @@ -5,7 +5,6 @@ import ( "bytes" "io/ioutil" "path/filepath" - "regexp" "sort" "strconv" "strings" @@ -15,6 +14,7 @@ import ( "github.com/gobwas/glob" "github.com/jdkato/prose/tag" "github.com/jdkato/prose/tokenize" + "github.com/jdkato/regexp" ) // AlertLevels holds the possible values for "level" in an external rule. diff --git a/core/format.go b/core/format.go index d663c067..3f299380 100755 --- a/core/format.go +++ b/core/format.go @@ -2,8 +2,9 @@ package core import ( "path/filepath" - "regexp" "strings" + + "github.com/jdkato/regexp" ) // CommentsByNormedExt determines what parts of a file we should lint -- e.g., diff --git a/core/location.go b/core/location.go index 5d1a48b1..15ce7b9c 100644 --- a/core/location.go +++ b/core/location.go @@ -1,9 +1,10 @@ package core import ( - "regexp" "strings" "unicode/utf8" + + "github.com/jdkato/regexp" ) // initialPosition calculates the position of a match (given by the location in diff --git a/spell/aff.go b/spell/aff.go index a5de55d5..261236d1 100644 --- a/spell/aff.go +++ b/spell/aff.go @@ -4,9 +4,10 @@ import ( "bufio" "fmt" "io" - "regexp" "strconv" "strings" + + "github.com/jdkato/regexp" ) // AffixType is either an affix prefix or suffix diff --git a/spell/gospell.go b/spell/gospell.go index 75d1388a..d08fa3d0 100644 --- a/spell/gospell.go +++ b/spell/gospell.go @@ -6,8 +6,9 @@ import ( "io" "log" "os" - "regexp" "strings" + + "github.com/jdkato/regexp" ) // GoSpell is main struct diff --git a/spell/words.go b/spell/words.go index d8e3129a..5dd1632b 100644 --- a/spell/words.go +++ b/spell/words.go @@ -1,9 +1,10 @@ package spell import ( - "regexp" "strings" "unicode" + + "github.com/jdkato/regexp" ) // number form, may include dots, commas and dashes diff --git a/styles/plugins/Sequence.go b/styles/plugins/Sequence.go index 0226e217..7100fc05 100755 --- a/styles/plugins/Sequence.go +++ b/styles/plugins/Sequence.go @@ -5,10 +5,10 @@ package main import ( - "regexp" "strings" "github.com/errata-ai/vale/v2/core" + "github.com/jdkato/regexp" ) var pat = regexp.MustCompile(`dialog \w+`) diff --git a/ui/error.go b/ui/error.go index 2d46f14a..c55116df 100644 --- a/ui/error.go +++ b/ui/error.go @@ -6,11 +6,11 @@ import ( "io" "log" "os" - "regexp" "strconv" "strings" "github.com/errata-ai/vale/v2/core" + "github.com/jdkato/regexp" "github.com/mattn/go-colorable" )