Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explosions: improve performance #5435

Draft
wants to merge 2 commits into
base: Pickups
Choose a base branch
from
Draft

Explosions: improve performance #5435

wants to merge 2 commits into from

Conversation

tigerw
Copy link
Member

@tigerw tigerw commented Jul 19, 2022

Tested on Release, Windows ia32, 17³ sphere of TNT created with WorldEdit.

Summary: changes reduce time for TPS to recover by 39% when no pickup entities are spawned, and make the server not freeze compeltely when pickup entities are spawned. The changes achieve this by coalescing pickup spawns during explosions, improving pickup behaviour not to do unnecessary work when idle, and improving block tracer performance.

Below are the tests I ran. Screenshots taken without pickup spawns since the client couldn't handle it otherwise.

Prior (with pickup spawns). Server doesn't recover due to tens of thousands of pickup entities, test stopped at 2 min 25 sec.
Prior (with pickup spawns)

Prior (without pickups). Server recovers in 56 sec.
Prior (without pickups)

Prior blast result.
Prior blast result

After (with pickup spawns). Server recovers to 19.68 TPS after 51 sec, but with high CPU load.
image

After (without pickups). Server recovers in 34 sec.
image

After blast result.
image

Comment on lines +76 to +99
// Clamp the start coords into the world by advancing them along the line:
if (a_Start.y < 0)
{
if (a_End.y < 0)
{
// Nothing to trace:
a_Callbacks.OnNoMoreHits();
return true;
}

a_Start = FixStartBelowWorld(a_Start, a_End);
a_Callbacks.OnIntoWorld(a_Start);
}
else if (a_Start.y >= cChunkDef::Height)
{
if (a_End.y >= cChunkDef::Height)
{
a_Callbacks.OnNoMoreHits();
return true;
}

a_Start = FixStartAboveWorld(a_Start, a_End);
a_Callbacks.OnIntoWorld(a_Start);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can have it's very own function :)

@12xx12 12xx12 self-requested a review October 17, 2022 10:28
@tigerw
Copy link
Member Author

tigerw commented Nov 2, 2022

I have some minor updates for this one, but first I will make #5434 ready, which this branch depends on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants