amethyst / amethyst/bracket-lib

Slow re-render on terminal for large view

Offen
#183 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
1.7k
Forks
126
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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:

Screen Shot 2020-12-27 at 2 02 57 PM

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 :).

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.