On Fri, Dec 16, 2016 at 4:27 PM adonovan via golang-nuts < golang-nuts@googlegroups.com> wrote:
> ssadump is loading, cgo-preprocessing, parsing, and type-checking the entire transitive closure of source files required by the current package, then building its SSA representation in a second pass, so these measurements are not at all comparable. I did not meant any unfair comparison, I just trusted what you wrote earlier in a different thread ;-) ---- On Tue, Dec 13, 2016 at 3:49 PM adonovan via golang-nuts < golang-nuts@googlegroups.com> wrote: > For example, with no flags, ssadump simply type-checks the specified packages: > > $ go get golang.org/x/tools/cmd/ssadump > $ cat a.go > package main > var x int = "string" > $ ssadump a.go > a.go:2:13: cannot convert "string" (untyped string constant) to int That's why I used it as a base line ---- > Two other data points: > ... > then it loads that package and its dependencies from source in under 700ms. Nice. > 2) The golang.org/x/tools/cmd/gotype tool, which loads only a single package from source, and loads export data for all imports, can process that package in under 100ms. I wanted to be independent of .a files. I agree with what you have mentioned in the other thread - they are non reliable to be up to date. > The go/parser is plenty fast enough. ssadump may be the wrong starting point for how to use it, though. go/{scanner,parser} speed is okay. It's problem is that it does not scale well in parallel execution when there's a shared token.FileSet. That's the reason for internal/ftoken (locks on .File(), but the the returned *File methods do no more locking whatsoever): jnml@r550:~/src/github.com/cznic/browse/internal/gc$ go version go version go1.7.4 linux/amd64 jnml@r550:~/src/github.com/cznic/browse/internal/gc$ go test -bench . BenchmarkScanner/StdGo-4 10 173466122 ns/op 41.53 MB/s BenchmarkScanner/Std-4 30 37032476 ns/op 194.52 MB/s BenchmarkParser/StdGo-4 5 275074432 ns/op 26.19 MB/s BenchmarkParser/Std-4 10 138686331 ns/op 51.94 MB/s PASS ok github.com/cznic/browse/internal/gc 15.725s jnml@r550:~/src/github.com/cznic/browse/internal/gc$ Again, the comparison is not completely fair, go/{scanner/parser} does more than this internal stuff is doing. At least as of now. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.