amethyst / amethyst/bracket-lib
Slow re-render on terminal for large view
- Dominant language
- Rust
- Stars
- 1.7k
- Forks
- 126
- PR merge metrics
- No merged PRs in 30d
Description
I've been playing with the dungeon_crawl app in the "Hands-On_Rust" book. I added a command line option to allow for user definition of world sizes. I noticed that play gets pretty slow when I have a large world (i.e. 160 by 100 (2x the default in both dimensions, so 4x the world size in the book)), that I get a noticeable lag in display response to cursor input.
So I decided, maybe it's time for me to look into profiling and see if I can find what I've done to make this thing slow.
I installed cargo-instruments and tested for a few seconds. This is what the drill down looks like:

If I'm reading this right (distinctly possible I'm not), 21 of 26 seconds was spent in bracket_terminal::hal::backing::simple_console_backing::rebuild_vertices (17 seconds of that is spent in ```push_point()```)
I'm taking, from that, that there's not much I can do in my code to speed things up.
It's only in the debug build that there's a noticeable delay. The release build is still quite responsive.
As such, I wouldn't really consider this a bug, just pointing out where I found a bottle-neck.
I'd guess that bounds checking or something of the like is what's killing it.
If there's interest, I might look into taking a crack at optimizing it (recently retired and plenty of time on my hands, and this is really helping me get the hang of Rust...). That said, I'm clearly a Rust "newb", so you may not want me anywhere near the code :).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.