JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
2.03k stars 614 forks source link

EFX Slowdown with Debug compiles #867

Closed eezstreet closed 8 years ago

eezstreet commented 8 years ago

Couldn't find an open issue about the topic, but I'm pretty sure I've narrowed down the cause of why EFX is so slow on debug builds.

https://github.com/JACoders/OpenJK/blob/3918cd94301fdc3ea468d4e6474c9f27c72168d3/code/cgame/FxScheduler.cpp#L888

The FXScheduler will spam a new ScheduledEffect every frame (potentially) for every effect primitive that has a delay.

Razish commented 8 years ago

printf it to see how often it happens

eezstreet commented 8 years ago

I spammed echo before firing a shot to make it more clear what is going on. I fired a bryar bolt at a pretty close distance at a wall, and put a print statement on the SScheduledEffect constructor. Here's what I got: http://i.imgur.com/tgdiUoc.jpg

That's 11 memory allocations being done for one shot. That's ridiculous.

ensiform commented 8 years ago

Potentially fixed in c986357 for JASP and 712627a for JK2SP

Please test both I checked JASP locally but JK2 hasn't been thoroughly tested.

ensiform commented 8 years ago

@eezstreet close if confirmed fixed for you.