Just Info: v0.0.19 pprof
bayashi opened this issue · comments
bayashi commented
Prof
--- a/main.go
+++ b/main.go
@@ -5,6 +5,8 @@ import (
"io"
"os"
+ "github.com/pkg/profile"
+
"github.com/bayashi/xfg/internal/xfgstats"
"github.com/bayashi/xfg/internal/xfgutil"
)
@@ -46,6 +48,7 @@ func main() {
}
func (cli *runner) run() (int, string) {
+ defer profile.Start(profile.ProfilePath(".")).Stop()
if o, err := cli.preXfg(); err != nil {
return exitErr, fmt.Sprintf("on preXfg() : %s", err)
} else {
Execution command
$ go build
$ ./xfg -s ~/.plenv/ plenv except --stats --no-pager
Build prof
$ go tool pprof xfg cpu.pprof
Result
(pprof) top30
Showing nodes accounting for 490ms, 100% of 490ms total
Showing top 30 nodes out of 130
flat flat% sum% cum cum%
60ms 12.24% 12.24% 60ms 12.24% regexp.(*bitState).shouldVisit (inline)
60ms 12.24% 24.49% 60ms 12.24% runtime/internal/syscall.Syscall6
40ms 8.16% 32.65% 100ms 20.41% regexp.(*Regexp).tryBacktrack
30ms 6.12% 38.78% 30ms 6.12% indexbytebody
30ms 6.12% 44.90% 30ms 6.12% runtime.memmove
30ms 6.12% 51.02% 30ms 6.12% runtime.nextFreeFast (inline)
20ms 4.08% 55.10% 60ms 12.24% main.(*xfg).processContentLine
20ms 4.08% 59.18% 230ms 46.94% main.(*xfg).scanContent
20ms 4.08% 63.27% 20ms 4.08% runtime.(*gcBits).bitp (inline)
20ms 4.08% 67.35% 90ms 18.37% runtime.mallocgc
10ms 2.04% 69.39% 40ms 8.16% bytes.IndexByte (inline)
10ms 2.04% 71.43% 10ms 2.04% gcWriteBarrier
10ms 2.04% 73.47% 10ms 2.04% internal/bytealg.IndexByte
10ms 2.04% 75.51% 10ms 2.04% internal/poll.(*fdMutex).increfAndClose
10ms 2.04% 77.55% 110ms 22.45% regexp.(*Regexp).backtrack
10ms 2.04% 79.59% 10ms 2.04% runtime.(*moduledata).textAddr
10ms 2.04% 81.63% 10ms 2.04% runtime.(*stkframe).getStackMap
10ms 2.04% 83.67% 10ms 2.04% runtime.exitsyscallfast
10ms 2.04% 85.71% 10ms 2.04% runtime.growslice
10ms 2.04% 87.76% 20ms 4.08% runtime.pcvalue
10ms 2.04% 89.80% 10ms 2.04% runtime.spanHasSpecials (inline)
10ms 2.04% 91.84% 50ms 10.20% runtime.systemstack
10ms 2.04% 93.88% 10ms 2.04% runtime/internal/atomic.(*UnsafePointer).StoreNoWB
10ms 2.04% 95.92% 30ms 6.12% strings.Contains (inline)
10ms 2.04% 97.96% 20ms 4.08% strings.Index
10ms 2.04% 100% 50ms 10.20% syscall.Syscall
0 0% 100% 50ms 10.20% bufio.(*Scanner).Scan
0 0% 100% 100ms 20.41% bufio.(*Scanner).Text (inline)
0 0% 100% 10ms 2.04% bufio.(*Writer).Flush
0 0% 100% 10ms 2.04% bufio.(*Writer).Write
bayashi commented