FWadCollection::GetLumpsInFolder performance problems

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

FWadCollection::GetLumpsInFolder performance problems

Post by UsernameAK »

FWadCollection::GetLumpsInFolder makes lag because it basically bruteforces all lumps in all wads. It affects performance of wads that use ACS SetFont heavily and have large amount of lumps.
The well-known wad that is affected by this bug is LSD. Inventory in this mod is made with ACS, and it lags heavily (drops to 1-2 fps) when it's open. Profiling showed that the performance bottleneck is exactly FWadCollection::GetLumpsInFolder.
Spoiler:
https://github.com/coelckers/gzdoom/blo ... .cpp#L1344 - the part of code which makes lag
Attachments
lsd-v1.2.2-gzfix.pk3
LSD gzdoom compat patch if you need some testing thingy. the lsd itself is in the spoiler
(666 Bytes) Downloaded 74 times
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: FWadCollection::GetLumpsInFolder performance problems

Post by Graf Zahl »

What crazy stuff does this mod do to trigger such an edge case?
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: FWadCollection::GetLumpsInFolder performance problems

Post by _mental_ »

It calls ACS SetFont with non-existing font named NORMAL. GZDoom tries to create it every tick.
User avatar
Rachael
Posts: 13542
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: FWadCollection::GetLumpsInFolder performance problems

Post by Rachael »

Maybe GZDoom should cache the error state of font creations so that it does not continue attempting this?
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: FWadCollection::GetLumpsInFolder performance problems

Post by UsernameAK »

The texture really exists. It's in gzdoom.pk3's graphics folder. That weird trick is used to use mouse in older ports.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: FWadCollection::GetLumpsInFolder performance problems

Post by Graf Zahl »

This looks more like an error in the font checking code, it shouldn't try to recreate a font if something with the name is found.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: FWadCollection::GetLumpsInFolder performance problems

Post by _mental_ »

UsernameAK wrote:The texture really exists. It's in gzdoom.pk3's graphics folder.
Where is this texture exactly? Also, querying FWADCollection and FTextureManager for it returns nothing.
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: FWadCollection::GetLumpsInFolder performance problems

Post by UsernameAK »

_mental_ wrote:
UsernameAK wrote:The texture really exists. It's in gzdoom.pk3's graphics folder.
Where is this texture exactly? Also, querying FWADCollection and FTextureManager for it returns nothing.
Oh, i was wrong. It really doesn't exist. If you put some stub texture, it stops lagging.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: FWadCollection::GetLumpsInFolder performance problems

Post by _mental_ »

The simplest solution seems to be a removal of this condition. So, empty font will be created regardless of texture existence, and lumps lookup will happen only once.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: FWadCollection::GetLumpsInFolder performance problems

Post by Graf Zahl »

V_GetFont must not create placeholders, it would break the entire font system. This is simply bad use. The CheckFont ACS function exists for good reasons.
Post Reply

Return to “Closed Bugs [GZDoom]”