Closed JoelOtter closed 8 years ago
Not creating new canvas on every Draw may help. But the main bottleneck seems to be RuneWidth
(pprof) top10
55s of 57.30s total (95.99%)
Dropped 126 nodes (cum <= 0.29s)
Showing top 10 nodes out of 29 (cum >= 0.79s)
flat flat% sum% cum cum%
48.07s 83.89% 83.89% 48.07s 83.89% github.com/mattn/go-runewidth.(*Condition).RuneWidth
2.36s 4.12% 88.01% 51.24s 89.42% github.com/nsf/termbox-go.Flush
1.75s 3.05% 91.06% 55.38s 96.65% github.com/JoelOtter/termloop.(*Screen).Draw
0.74s 1.29% 92.36% 48.81s 85.18% github.com/mattn/go-runewidth.RuneWidth
0.61s 1.06% 93.42% 0.61s 1.06% github.com/JoelOtter/termloop.(*Screen).RenderCell
0.55s 0.96% 94.38% 0.55s 0.96% github.com/JoelOtter/termloop.(*BaseLevel).DrawBackground
0.45s 0.79% 95.17% 0.45s 0.79% runtime.futex
0.24s 0.42% 95.58% 0.75s 1.31% github.com/JoelOtter/termloop.(*Rectangle).Draw
0.13s 0.23% 95.81% 0.87s 1.52% runtime.makeslice
0.10s 0.17% 95.99% 0.79s 1.38% runtime.newarray
Since Flush seems to be the bottleneck here are some ideas:
I'm going to close this for now as we've made pretty good strides. If anyone has any further ideas for performance improvements, please open a pull request or shout out in the Gitter chat.
Termloop's performance is acceptable for most applications, but that doesn't mean we shouldn't try and make it better. Let's use this issue to track ideas for improving performance. A couple of potential things to investigate:
Feel free to add more in comments.