amethyst / amethyst/bracket-lib

Slow re-render on terminal for large view

Đang mở
#183 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
1.7k
Fork
126
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.