amethyst / amethyst/bracket-lib

Slow re-render on terminal for large view

Aberta
#183 1 comentário 1 reação 0 responsáveis Ver no GitHub
Linguagem predominante
Rust
Estrelas
1.7k
Forks
126
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.