kvark / vange-rs

Rusty Vangers clone
https://vange.rs
Apache License 2.0
427 stars 21 forks source link

Web Version: Terrible perfomance (cpu_step) #167

Closed caiiiycuk closed 2 years ago

caiiiycuk commented 2 years ago

~900 ms per each frame, 97% of time spent in physics:step function

изображение изображение изображение vange-rs-profile(chrome).json.gz

kvark commented 2 years ago

Why on earth would cross take a lot of time? Do you have a link? I'd profile it on FF.

caiiiycuk commented 2 years ago

There are two places that I changed in game to work, maybe they affected performance.

1) https://github.com/kvark/vange-rs/pull/149/files#diff-e58ec0edb03532e6e7809132781b6da92380f39f8ac4156623689f3910d71a5bR251

Constant delta 16, maybe it's too much or too small?

2) Not in PR (https://github.com/kvark/vange-rs/blob/HEAD/bin/road/game.rs#L508) I changed spin_ver to 1.0, because I didn't get input from keyboard to work yet. Maybe this value is too high and physics goes crazy?

Regarding to link, yes I can do it, but I want to add true keyboard support first (maybe it can help to understand why it so).

caiiiycuk commented 2 years ago

Problem was solved when I pass real delta time

kvark commented 2 years ago

What delta were you passing?

caiiiycuk commented 2 years ago

https://github.com/caiiiycuk/vange-rs/blob/vange-rs-web/bin/boilerplate.rs#L267 Now I pass the real time delta, before I passed 16 which is wrong