Skip to content

Commit

Permalink
Fix words in README.md, make test more robust against directory-name …
Browse files Browse the repository at this point in the history
…simplification
  • Loading branch information
dr2chase committed Apr 3, 2020
1 parent c8c3b1e commit 452bc97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# gc-lsp-tools

gclsp_prof reads the Go compiler's LSP-encoded logging of places where an optimization was not quite possible,
gclsp_prof reads the Go compiler's LSP-encoded logging of places where an optimization was not possible,
and combines that with profiling data to see if you might be able to improve performance by tweaking your code slightly.
The use of profiling data is to avoid overwhelming users with noise about all the not-performance-critical places
that the optimizer left a check in or was forced to do a heap allocation, etc.
Expand Down
19 changes: 11 additions & 8 deletions cmd/gclsp_prof/main_test.go
Expand Up @@ -70,19 +70,22 @@ func TestIt(t *testing.T) {
split := strings.Split(out, "\n")

// This can fail if the profiles are far from expected values, which might happen sometimes or on some architectures.

// The working directory can be ID'd in several ways
pwdre := "[$](PWD|(GOPATH|HOME/.*)/src/github.com/dr2chase/gc-lsp-tools/cmd/gclsp_prof/testdata)"
matchREs := []string{
" *[0-9]+[.][0-9]+%, [$]PWD/foo[.]go:[0-9]+[)]",
" *[(]inline[)] [$]PWD/foo[.]go:[0-9]+",
" *[0-9]+[.][0-9]+%, "+pwdre+"/foo[.]go:[0-9]+[)]",
" *[(]inline[)] "+pwdre+"/foo[.]go:[0-9]+",
" *isInBounds [(]at line [0-9]+[)]",
" *[(]inline[)] [$]PWD/foo[.]go:[0-9]+",
" *[0-9]+[.][0-9]+%, [$]PWD/foo[.]go:[0-9]+[)]",
" *[(]inline[)] [$]PWD/foo[.]go:[0-9]+",
" *[(]inline[)] "+pwdre+"/foo[.]go:[0-9]+",
" *[0-9]+[.][0-9]+%, "+pwdre+"/foo[.]go:[0-9]+[)]",
" *[(]inline[)] ["+pwdre+"/foo[.]go:[0-9]+",
" *isInBounds [(]at earlier line [0-9]+[)]",
" *[(]inline[)] [$]PWD/foo[.]go:[0-9]+",
" *[(]inline[)] "+pwdre+"/foo[.]go:[0-9]+",
" *isInBounds [(]at line [0-9]+[)]",
" *[(]inline-earlier [)] [$]PWD/foo[.]go:[0-9]+",
" *[(]inline-earlier [)] "+pwdre+"/foo[.]go:[0-9]+",
" *isInBounds [(]at later line [0-9]+[)]",
" *[(]inline[)] [$]PWD/foo[.]go:[0-9]+",
" *[(]inline[)] "+pwdre+"/foo[.]go:[0-9]+",
}
expectedTailLen := len(matchREs)+1 // Last line is blank.
if len(split) > expectedTailLen {
Expand Down

0 comments on commit 452bc97

Please sign in to comment.