Page 1 of 1

addBeacon slow?

Posted: 25 May 2018, 06:11
by Berserk Cyborg
I have been experimenting with semperfi-js some more and think successive calls of addBeacon() are particularly intensive on performance. For context, I have it drop a beacon to its allies from within eventAttacked with a throttle of 30 seconds from the last time it was attacked by an enemy. And the beacons are mostly informative at best.

What is most noticeable is just how large the gap is when an ally is present. Take for example a 3v3 (Semperfi-js against Nullbot) on the Melting map. Each AI peaks around 25 units until the other side starts to win and should semperfi-js be the winning side the lag probably pauses Warzone for 1/5 a second as a beacon is dropped.

Now, on a map like Monocot where it's a 1v1v1, the lack of an ally to receive a beacon makes the worse perf of eventAttacked hovers around 5-7 ms. Then doing a 2v2 on sk-rush the worse perf time with eventAttacked jumps up to ~25 ms with just one ally. It don't matter if it is being called in eventAttacked as it will do just as bad in another function much to the same effect.

And before anyone gets too excited, the main addition is that it can research and produce a few bunker buster and maybe rush slightly better.
(16.23 KiB) Downloaded 15 times
A sample perf log of two skirmish battles
(2.32 KiB) Downloaded 15 times

Re: addBeacon slow?

Posted: 25 May 2018, 19:52
by Per
Unfortunately, addBeacon() eventually leads down into the messages code, which is one of the last remaining almost entirely unintelligible hell-holes in the codebase ...

Without having looked at it, I would guess the reason is that it calls into the graphics and audio code for each blip is adds...

Re: addBeacon slow?

Posted: 26 May 2018, 09:34
by Prot
May be a best decision is a check, if ally player is player(not AI), then drop beacon.