#1 2016-10-14 10:03:22

RaXaR
Member

300% Perf. increase - fluke or major-ass bug?

Hi :)

As the title suggests, I have no idea what I am doing.
I don't know if it's a bug or a fluke or simply my misunderstanding. Whatever it is I got 300% performance increase on a very large map. Screen shots attached:
Before
After

What I did
Using SVN revision 2118.
I changed the maximum allowed map size in /src/engine/world.cpp: line 1406 to 20.
Went into /src/engine/renderva.cpp line 129 added a "break;" before the closing "while" bracket.
Built and started the release exe, at the main menu entered /newmap 18 in the console.

Extra info
I found the issue when running a random MSVC profile on the code for a minute or so. It said that addvisibleva(...) was eating ~50% performance and showed that the while loop was the culprit. I don't know why it drills down or even how it fits into the larger picture really. But I suspect that this change makes it a brute-force thing.

My PC specs
Pc is about ~6 years old
Intel i7-3770K @ 3.50GHz
Asus nVidia 680
RAM 32GB

Conclusion
I would really* like to know why this worked and what the ramifications are of this change. So if someone has some insight, please share :)

Thanks!

Offline

#2 2016-10-14 21:34:40

RaZgRiZ
Moderator

Re: 300% Perf. increase - fluke or major-ass bug?

What I would really like to know is why you're getting such absurdly low framerates to begin with.

Offline

#3 2016-10-15 03:10:16

RaXaR
Member

Re: 300% Perf. increase - fluke or major-ass bug?

@RaZgRiZ it's because I put the worldsize to 18. At the regular max (16) it runs buttery smooth.

Offline

#4 2016-10-15 07:39:54

RaZgRiZ
Moderator

Re: 300% Perf. increase - fluke or major-ass bug?

Oh woops, I thought I saw the bottom one as being 16, soz.

Offline

#5 2016-10-18 03:47:45

chasester
Member

Re: 300% Perf. increase - fluke or major-ass bug?

My Guess is this is to do the alpha channeling and partily visable cubes 0.0 but ill look into it. Shouldnt be doing that much preformance jump. Especially not on a blank map.

chasester


@edit
this loop is looping 4000 - 8000 time a frame (roughly) on a blank size 10 map.

I removed like you said and it seems to have no errors. I tested:

Alpha,
glass,
materials.
Cube offsets
z-buffer model to model
z-buffer model to octtree
model to glass
model to alpha
model to water


So no wierd lighting or other errors. Im not 100% sure what it does but my guess is its supose to brute force vas on the same hash square. But This seems to be rare to cause an issue?

Now it should be noted I also have a gen 2 i7 with a 550 ti (which is a worst graphics card) this doesnt effect my game good or bad. I still run complex with full settings with about 4-15 fps. So I would check to see if your cards drivers are up to date.

Last edited by chasester (2016-10-18 04:08:07)

Offline

#6 2016-10-18 17:18:22

RaXaR
Member

Re: 300% Perf. increase - fluke or major-ass bug?

@chasester Thanks for looking into it. I dug into the code a bit and came to a similar conclusion that this code relates to culling/visibility. I don't mind that it's so slow on a huge map since using a map bigger than 16 is unlikely/rare.

I was just curious as to why the game seems to run fine when the while loop only does one iteration. I think the effects of this change would be more visible when you have lots of complex geometry on the map.

I noticed this performance hit when I run maps larger than 17. (Was testing the limits of the engine a bit)
Map size 17, 16, 15 and smaller have no performance impact with this change.

Map size 18+ simply croaks. :P

Offline

#7 2016-10-18 21:20:20

RaZgRiZ
Moderator

Re: 300% Perf. increase - fluke or major-ass bug?

This got me wondering, what would happen if you tried to open a size 18 map in a vanilla game? Does it work? :P

Offline

#8 2016-10-18 22:39:47

RaXaR
Member

Re: 300% Perf. increase - fluke or major-ass bug?

Yip it does! It's still slow (since vanilla doesn't have any of the changes I listed in this thread). But it works! :)

Here's the map file worldsize18.ogz (~16KB)

PS it takes very long to load/unload the map. I checked the code and it seems to drill down from the worldroot cube all the way to the smallest ones. At world size 18 that would be 8^18 cubes to check (if my math is right).

Offline

#9 2016-10-19 02:57:47

chasester
Member

Re: 300% Perf. increase - fluke or major-ass bug?

well not really 8^18 but yes IDK I didnt see any performance increase on the maps I looked at. Maybe this is just a nuance that only gives you an increase on very large maps that dont have any details. You should do more research on this. But I dont think that this function hangs all that much from the test I did.

Chasester

Offline

Board footer