Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fuzzy suggestions causes performance degredation #2309

@maxmzkrcensys

Description

@maxmzkrcensys

Description

We are seeing a large performance difference with the fuzzy suggestions commit on a large project. We have 1006 tasks in our project right now and are seeing a 17.554s increase in runtime

$ gco a33544101a32fc6cd9dc23189077fa7aa76ae97f~1          
Previous HEAD position was a3354410 fix: fuzzy model was not instanciated (#2200)
HEAD is now at 1c35358f v3.43.3
$ time go run ./cmd/task -l -d ~/pipeline | wc -l
1006
go run ./cmd/task -l -d ~/pipeline  13.59s user 1.52s system 1327% cpu 1.138 total
wc -l  0.00s user 0.00s system 0% cpu 1.137 total
$ gco a33544101a32fc6cd9dc23189077fa7aa76ae97f
HEAD is now at a3354410 fix: fuzzy model was not instanciated (#2200)
$ time go run ./cmd/task -l -d ~/pipeline | wc -l 
1006
go run ./cmd/task -l -d ~/pipeline  83.61s user 19.30s system 550% cpu 18.692 total
wc -l  0.00s user 0.01s system 0% cpu 18.691 total
diff --git a/cmd/task/task.go b/cmd/task/task.go
index 31538afc..b97b8a5a 100644
--- a/cmd/task/task.go
+++ b/cmd/task/task.go
@@ -5,6 +5,7 @@ import (
        "fmt"
        "os"
        "path/filepath"
+       "runtime/pprof"
 
        "github.com/spf13/pflag"
 
@@ -42,6 +43,15 @@ func main() {
 }
 
 func run() error {
+       // write profile to a file
+       f, err := os.Create("/home/max/task/cpu.prof")
+       if err != nil {
+               return fmt.Errorf("failed to create CPU profile file: %w", err)
+       }
+       defer f.Close()
+       pprof.StartCPUProfile(f)
+       defer pprof.StopCPUProfile()
+
        log := &logger.Logger{
                Stdout:  os.Stdout,
                Stderr:  os.Stderr,

yields

Image

Version

v3.44.0

Operating system

Linux

Experiments Enabled

No response

Example Taskfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions