[SPIGOT-591] Activation range higher than defaults causes immense lag Created: 20/Feb/15  Updated: 17/Mar/15  Resolved: 20/Feb/15

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Piotr Petrus Assignee: Thinkofname
Resolution: Fixed Votes: 2
Labels: None

Attachments: PNG File mcp-get.png     PNG File warmroast.png    

 Description   

The empirical description of the bug is in the summary. Below is what we found in code and questions / suggestions where it could stem from.

We found that while Spigot 1.7 was running fine with

entity-activation-range:
      animals: 128
      monsters: 64
      misc: 64

Spigot 1.8 caused immense lag. Lag is captured on the WarmRoast screen cap in attached files.

We changed those settings to recommended ones by Spigot defaults.

entity-activation-range:
      animals: 32
      monsters: 32
      misc: 16

If you look at our WarmRoast screen, thing that creates the HashSets (bottom of the tree) is this method in Google's multimap: https://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java#303

We think that code does the following: if no collection for that key is found, create a new collection, put the key there and return that collection.

We found that Spigot is calling that method and it is all connected somehow to activation range of entities. Here what is going inside:

1. Every tick, for every world, this method is called ActivationRange.activateEntities(World world);
2. For every player in that world, get all the chunks around him, and run second method ActivationRange.activateChunkEntities(Chunk chunk)
3. Nothing worrying really happens here, other than getting the iterator of chunk.entitySlices (from the warmroast tree we see that there lies the problem)
4. Now, moving to MCP decompiled code (we tried to find this in Spigot classes, we might be blind, sorry if that’s the case!), see the second attached screenshot.
5. For some reason, the collection (on which we call get) does not have the required key, thus requiring the creation of new collection.

This is all that we could piece together. I hope it’s not a total waste of your time – we do know that lowering those values resolves the issue but we’re still wondering why the change is so dramatic insofar requiring nerfing activation to 1-2 chunks.

Best regards!

PS: We’ll gladly provide more info, please ask us anything you think could help here.



 Comments   
Comment by Thinkofname [ 17/Mar/15 ]

144 is pretty high, higher than vanilla I think

Comment by Piotr Petrus [ 17/Mar/15 ]

Thinkofdeath Is there any way this bug still exists for animals? I bumped up animal activation to 144 and suffered bad lag. Lowering it back to 48 helped.

Comment by Piotr Petrus [ 20/Feb/15 ]

I’m in awe.

Thank you for fixing, so happy to have helped.

Generated at Sat Dec 13 15:18:39 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.