Page MenuHomeWildfire Games

Speed up carry capacity tech research / resource value modification.
ClosedPublic

Authored by wraitii on Jan 15 2021, 7:26 PM.

Details

Summary

A quick Profiling on a 1v1 has show that carry capacity techs can actually lead to serious lag spikes.
The problem is that they change 4 carry capacity modifiers, and the modifiersManager is currently not clever enough to batch these changes, so it Broadcasts 4 times.
Units will then recompute their gather rates 4 times, and since most units are affected, this can be quite slow.

In the attached replay, it takes ~90ms on turn 2658. I have no doubt that with more players, it would become unacceptably slow.

By doing slightly less work, we can bring this down to about 25ms, which is a much more acceptable lag spike, even with 4x the units.

Test Plan

Agree with the changes.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

wraitii created this revision.Jan 15 2021, 7:26 PM
wraitii edited the summary of this revision. (Show Details)Jan 15 2021, 7:28 PM

Build has FAILED

builderr-debug-macos.txt
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback.tbd and library file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreVideo.framework/CoreVideo.tbd and library file /System/Library/Frameworks//CoreVideo.framework/CoreVideo are out of sync. Falling back to library file for linking.
ld: warning: text-based stu

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/2883/display/redirect
See console output for more information: https://jenkins.wildfiregames.com/job/macos-differential/2883/display/redirectconsole

wraitii requested review of this revision.Jan 15 2021, 7:39 PM

Fix test.

binaries/data/mods/public/simulation/components/ResourceGatherer.js
136 ↗(On Diff #15356)

Better to do the substr in the calling function.

Stan added a subscriber: Stan.Jan 15 2021, 7:53 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/ResourceGatherer.js
136 ↗(On Diff #15356)

I suppose we can't set the type in the message?

386–394 ↗(On Diff #15356)

Maybe, saves you one equality check.

Freagarach added inline comments.Jan 15 2021, 7:57 PM
binaries/data/mods/public/simulation/components/ResourceGatherer.js
386–394 ↗(On Diff #15356)

And looks nicer.

Silier requested changes to this revision.Jan 15 2021, 8:09 PM
Silier added a subscriber: Silier.
Silier added inline comments.
binaries/data/mods/public/simulation/components/ResourceGatherer.js
137 ↗(On Diff #15356)

what ?

This revision now requires changes to proceed.Jan 15 2021, 8:09 PM
Silier resigned from this revision.Jan 15 2021, 8:10 PM

:D sorry

This revision now requires review to proceed.Jan 15 2021, 8:10 PM
Silier added inline comments.Jan 15 2021, 8:11 PM
binaries/data/mods/public/simulation/components/ResourceGatherer.js
137 ↗(On Diff #15356)

i am tired, I saw for :D

wraitii updated this revision to Diff 15377.Jan 16 2021, 11:58 AM

Better code, fix tests.

Build is green

builderr-debug-macos.txt
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback.tbd and library file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreVideo.framework/CoreVideo.tbd and library file /System/Library/Frameworks//CoreVideo.framework/CoreVideo are out of sync. Falling back to library file for linking.
ld: warning: text-based stu

See https://jenkins.wildfiregames.com/job/macos-differential/2891/display/redirect for more details.

Hotfix, proper fix would probably involve #5891.
But, still a nice performance improvement.

binaries/data/mods/public/simulation/components/ResourceGatherer.js
317 ↗(On Diff #15377)

While at it? ^^

Freagarach accepted this revision.Jan 17 2021, 7:19 AM
This revision is now accepted and ready to land.Jan 17 2021, 7:19 AM
Freagarach added inline comments.Jan 17 2021, 7:20 AM
binaries/data/mods/public/simulation/components/ResourceGatherer.js
387 ↗(On Diff #15377)

Please mind mods (consider to revert to Stan's suggested code).

Freagarach added inline comments.Jan 17 2021, 9:00 AM
binaries/data/mods/public/simulation/components/ResourceGatherer.js
387 ↗(On Diff #15377)

Ignore that.