mojira.dev
MC-118865

This isn't a bug, but a performance issue! Functions cause lag.

I know this is crazy, but I am running a handful of functions that have over 60000 commands and it is causing a lot of lag, not computer lag, but the entities stutter when they move and the game clock seems to be stuttering. I just want to know if there will be any performance updates for functions in the future because for making function mods like this, would be helpful. It doesn't seem to be affecting sounds, blocks (breaking, or particles or functions of those blocks (block updates are almost unaffected)), or crafting. Holding the carrot on a stick triggers the functions.

Attachments

Comments 5

Please generate a debug profiler result by running /debug start, playing the game for a bit, and then running /debug stop. Then, attach the profiler results (located in .minecraft/debug) to this issue.

(gun is the name of the function folder, this was just an experiment to see how I could make fake bows/throwing knives)


Minecraft Profiler Results ----
// Hello world

Time span: 14575 ms
Tick span: 255 ticks
// This is approximately 17.50 ticks per second. It should be 20 ticks per second

— BEGIN PROFILE DUMP —

[00] commandFunctions - 65.93%/65.93%
[00] levels - 32.59%/32.59%
[01] | gun - 99.89%/32.55%
[02] | | tick - 98.31%/32.00%
[03] | | | entities - 46.20%/14.79%
[04] | | | | regular - 98.52%/14.57%
[05] | | | | | tick - 96.86%/14.11%
[06] | | | | | | ai - 31.23%/4.41%
[07] | | | | | | | newAi - 95.34%/4.20%
[08] | | | | | | | | goalSelector - 31.03%/1.30%
[09] | | | | | | | | | goalSetup - 77.49%/1.01%
[10] | | | | | | | | | | unspecified - 93.30%/0.94%
[10] | | | | | | | | | | pathfind - 6.70%/0.07%
[09] | | | | | | | | | unspecified - 20.12%/0.26%
[09] | | | | | | | | | goalTick - 2.39%/0.03%
[08] | | | | | | | | unspecified - 28.40%/1.19%
[08] | | | | | | | | controls - 16.70%/0.70%
[09] | | | | | | | | | unspecified - 67.36%/0.47%
[09] | | | | | | | | | look - 17.44%/0.12%
[09] | | | | | | | | | move - 10.10%/0.07%
[09] | | | | | | | | | jump - 5.10%/0.04%
[08] | | | | | | | | targetSelector - 9.58%/0.40%
[09] | | | | | | | | | unspecified - 70.75%/0.28%
[09] | | | | | | | | | goalSetup - 29.25%/0.12%
[08] | | | | | | | | navigation - 9.51%/0.40%
[09] | | | | | | | | | unspecified - 94.98%/0.38%
[09] | | | | | | | | | pathfind - 5.02%/0.02%
[08] | | | | | | | | checkDespawn - 2.92%/0.12%
[08] | | | | | | | | mob tick - 1.16%/0.05%
[08] | | | | | | | | sensing - 0.69%/0.03%
[07] | | | | | | | unspecified - 4.66%/0.21%
[06] | | | | | | travel - 27.95%/3.94%
[07] | | | | | | | move - 52.98%/2.09%
[07] | | | | | | | unspecified - 24.60%/0.97%
[07] | | | | | | | rest - 22.42%/0.88%
[06] | | | | | | unspecified - 23.35%/3.29%
[06] | | | | | | entityBaseTick - 6.29%/0.89%
[07] | | | | | | | unspecified - 96.41%/0.86%
[07] | | | | | | | portal - 3.59%/0.03%
[06] | | | | | | livingEntityBaseTick - 4.78%/0.67%
[06] | | | | | | move - 1.57%/0.22%
[06] | | | | | | looting - 1.36%/0.19%
[06] | | | | | | push - 1.21%/0.17%
[06] | | | | | | headTurn - 0.74%/0.10%
[06] | | | | | | rest - 0.53%/0.08%
[06] | | | | | | mobBaseTick - 0.51%/0.07%
[06] | | | | | | chunkCheck - 0.28%/0.04%
[06] | | | | | | rangeChecks - 0.11%/0.02%
[06] | | | | | | jump - 0.08%/0.01%
[05] | | | | | unspecified - 3.05%/0.44%
[05] | | | | | remove - 0.10%/0.01%
[04] | | | | players - 0.76%/0.11%
[05] | | | | | tick - 85.91%/0.10%
[06] | | | | | | unspecified - 96.91%/0.09%
[06] | | | | | | chunkCheck - 3.09%/0.00%
[05] | | | | | unspecified - 13.58%/0.02%
[05] | | | | | remove - 0.51%/0.00%
[04] | | | | blockEntities - 0.42%/0.06%
[05] | | | | | unspecified - 90.11%/0.06%
[05] | | | | | avs - 6.89%/0.00%
[05] | | | | | avj - 3.00%/0.00%
[04] | | | | unspecified - 0.23%/0.03%
[04] | | | | remove - 0.06%/0.01%
[04] | | | | global - 0.01%/0.00%
[04] | | | | pendingBlockEntities - 0.00%/0.00%
[03] | | | mobSpawner - 31.40%/10.05%
[03] | | | tickBlocks - 17.39%/5.57%
[04] | | | | pollingChunks - 96.84%/5.39%
[05] | | | | | unspecified - 55.52%/2.99%
[05] | | | | | tickBlocks - 39.64%/2.14%
[06] | | | | | | unspecified - 78.77%/1.68%
[06] | | | | | | randomTick - 21.23%/0.45%
[05] | | | | | iceandsnow - 2.36%/0.13%
[05] | | | | | getChunk - 0.77%/0.04%
[05] | | | | | tickChunk - 0.75%/0.04%
[05] | | | | | thunder - 0.49%/0.03%
[05] | | | | | checkNextLight - 0.47%/0.03%
[04] | | | | playerCheckLight - 2.15%/0.12%
[05] | | | | | unspecified - 78.64%/0.09%
[05] | | | | | getBrightness - 20.34%/0.02%
[05] | | | | | checkedPosition < toCheckCount - 1.02%/0.00%
[04] | | | | unspecified - 1.01%/0.06%
[03] | | | village - 2.85%/0.91%
[03] | | | chunkSource - 1.01%/0.32%
[03] | | | unspecified - 0.71%/0.23%
[03] | | | chunkMap - 0.21%/0.07%
[03] | | | tickPending - 0.21%/0.07%
[04] | | | | unspecified - 79.04%/0.05%
[04] | | | | ticking - 16.93%/0.01%
[04] | | | | cleaning - 4.03%/0.00%
[03] | | | portalForcer - 0.02%/0.01%
[02] | | tracker - 1.56%/0.51%
[02] | | unspecified - 0.08%/0.03%
[02] | | timeSync - 0.05%/0.02%
[01] | unspecified - 0.11%/0.04%
[00] jobs - 0.76%/0.76%
[01] | unspecified - 92.27%/0.70%
[01] | rest - 4.00%/0.03%
[01] | move - 3.25%/0.02%
[01] | pathfind - 0.47%/0.00%
[00] connection - 0.65%/0.65%
[01] | unspecified - 67.74%/0.44%
[01] | travel - 18.34%/0.12%
[02] | | rest - 38.82%/0.05%
[02] | | move - 38.16%/0.05%
[02] | | unspecified - 23.01%/0.03%
[01] | entityBaseTick - 6.21%/0.04%
[02] | | unspecified - 93.83%/0.04%
[02] | | portal - 6.17%/0.00%
[01] | livingEntityBaseTick - 4.21%/0.03%
[01] | ai - 1.20%/0.01%
[02] | | unspecified - 77.95%/0.01%
[02] | | newAi - 22.05%/0.00%
[01] | keepAlive - 0.84%/0.01%
[01] | push - 0.79%/0.01%
[01] | headTurn - 0.60%/0.00%
[01] | rangeChecks - 0.04%/0.00%
[01] | jump - 0.03%/0.00%
[00] unspecified - 0.07%/0.07%
[00] tickables - 0.00%/0.00%
[00] players - 0.00%/0.00%
[00] snooper - 0.00%/0.00%
[00] tallying - 0.00%/0.00%
— END PROFILE DUMP —

I did it again only holding the carrot on a stick and it dropped down to 0.89 ticks per second.

I believe it is just spending a lot of the time of the run instance on reading the file and breaking it down, 64802 commands is a lot to parse.

Every single command needs to phrase; so many commands needing to phrase every tick causes lag, that's to be expected.

redstone563

(Unassigned)

Unconfirmed

Minecraft 1.12

Retrieved