To use this pack, add the pack to your test world's datapack folder and wait for TPI_trend (time per instance trend over the last 5 seconds) to go to 0 and stay around there. Then write down avgNsPerInst (average time in nanoseconds per instance over the last 5 seconds) and/or avgInstances (average number of instances run per tick over the last 5 seconds). This will give you a baseline for how much processing power the pack itself takes. Then edit instanceloop.mcfunction to call your function and repeat for any other functions you want to compare. You can restart the benchmark by calling /function benchmark:reset or /reload. You may also wish to change the tickTarget (target time in milliseconds that the benchmark attempts to fill). This can be done by either editing the appropriate line in init_benchmark.mcfunction or calling /scoreboard players set tickTarget BenchStats <value>. The range must be 0 < tickTarget < 50 and is suggested to be 10 <= tickTarget <= 40. Lower values may be more noisy since less instances are being averaged over and larger values tend to show worse numbers due to recursive loop overhead. If the F3 screen or log shows that ticks are taking longer than 50ms, then you should probably reduce tickTarget as I can't guarantee that the pack will behave well when Minecraft attempts to speed up the following ticks to catch up and may eventually cause the server watchdog to consider Minecraft crashed if the problem is bad enough. Note that since this pack can end up calling many commands recursively in a single tick, it's a good idea to increase the maxCommandChainLength in order to get accurate readings.
0 commit comments