amethyst / amethyst/bracket-lib

Slow re-render on terminal for large view

未关闭
#183 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
1.7k
派生
126
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。