A_RemoveLight causes severe lag on high detail maps

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

A_RemoveLight causes severe lag on high detail maps

Post by Marisa the Magician »

Discovered this accidentally while playing my mod recently. I have a certain projectile that manually attaches a light to itself, then removes it on death (mainly because it uses the same sprite and frame on both spawn and death, so I can't simply use gldefs to assign it).

The following file is a stripped down version of that projectile. Typing "summon loveheart" in any map with lots of complex geometry (this even includes Frozen Time, so there's that for a test), and waiting for the projectile to hit something, you'll notice gzdoom will freeze for a while, every time. It appears that the slowdown happens somewhere in FDynamicLight::CollectWithinRadius (a_dynlight.cpp line 356).
User avatar
Major Cooke
Posts: 8197
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: A_RemoveLight causes severe lag on high detail maps

Post by Major Cooke »

Curious. Does it lag more if you just deactivate the light in particular?
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: A_RemoveLight causes severe lag on high detail maps

Post by Marisa the Magician »

The lag is ONLY caused by removing that specific light the projectile attaches to itself.
User avatar
Rachael
Posts: 13851
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: A_RemoveLight causes severe lag on high detail maps

Post by Rachael »

What happens if you deactivate, and then remove the light? (Just going on a haunch here)
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: A_RemoveLight causes severe lag on high detail maps

Post by Marisa the Magician »

It's not possible to deactivate the light if it's handled through AttachLight.

There's no function for that.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49192
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_RemoveLight causes severe lag on high detail maps

Post by Graf Zahl »

I cannot reproduce any slowdown, not even in a debug build.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: A_RemoveLight causes severe lag on high detail maps

Post by Marisa the Magician »

Guess it fixed itself, can't reproduce it either.

Edit: Nevermind, it happened again, seems to be entirely random. In most cases it only happens on specific launches.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49192
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_RemoveLight causes severe lag on high detail maps

Post by Graf Zahl »

Are you even sure it's really the light and not a random coincidence?

This looks more like a garbage collection related problem. From the looks of it that projectile is spawning quite a bit of effects actors.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: A_RemoveLight causes severe lag on high detail maps

Post by Marisa the Magician »

Considering that I don't see the issue ever happen if I get rid of the light attach/remove, I doubt it's the effect actors. I spawn boatloads of those in the mod proper and there are no issues with that.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49192
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_RemoveLight causes severe lag on high detail maps

Post by Graf Zahl »

Does this still happen after today's change to the light management?
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: A_RemoveLight causes severe lag on high detail maps

Post by Marisa the Magician »

It's not happening anymore, it seems. But it appears that even in 4.6.1 it's already fixed. (nvm it actually still happens in 4.6.1)

No matter how many times I relaunch my mod and frozen time and fire the projectile that causes the issue, there are no freezes whatsoever with a fresh build. It's definitely fixed.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49192
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_RemoveLight causes severe lag on high detail maps

Post by Graf Zahl »

4.6.1 was before the fix. I only addressed a potential problem there yesterday.

Return to “Bugs [GZDoom]”