dot -Tcanon is slow because it does unnecessary layout
Forked off an issue from #2328 (comment 1230999525)
@steveroush mentions:
dot -Tcanon
I guess that dot is going through the layout phase even though canon will ignore it.
Indeed, I tried profiling -Tcanon with https://github.com/mstange/samply:
$ samply record --rate 100 /usr/local/bin/dot -Tcanon ~/Downloads/dot-causes-abend.dot
And I see it's spending a lot of time in dotLayout function: https://share.firefox.dev/3vNpo1k
I don't think this is particularly important, but I thought I'd file it here to track as an issue: -Tcanon
is the closest thing to an autoformatter (a la gofmt/rustfmt) that we have for Graphviz. And autoformatters should be fast. Maybe we could skip the layout if we're doing -Tcanon
. Or maybe that would have other, bad side-effects, I'm not sure.