Recent Discussions

Is there any fabric mods that can optimize the command dispatcher?

Unanswered
Programmer / Nerd / Human posted this in #questions
Messages16 messages
Views0 views
30% of my server's world tick is command execution, is there any mods to optimize it? preferably fabric 1.20.1
https://spark.lucko.me/O9f5SSRcXK
Philippine Crocodile
not really. if you have any datapacks or command blocks running, that's usually the issue. the main problem is the @e selector which needs to grab all entitites in the world and filter through them (or not), and calling that multiple times per tick is piss garbage on performance
normally mods and plugins can cache the result
for commands - you cannot
I think I just write a mod that caches the entities so not call the getEntities multiple times per tick where there should be no change in it's result

If a command spawns an entity then it is immediately queried by another command in the same tick it fails though
I don't think that should be something that matters for my usage though
There's also this other mod that caches the parsing result of commands https://modrinth.com/project/aP9wKOkW
Don't know how effective it would be, but probably not making it worse, I've backported it to 1.20.1 but haven't managed to test it yet
I've tested it, seems to literally do nothing
Philippine Crocodile
the better solution here is to drop whatever is doing those commands and replace it with a mod
I cannot it's part of the map
The map pre-dates datapacks so It uses command blocks
Nvm
The EntitySelector is unhashable because it is passed a lot of lambda expressions all the time, I can't verify if it's the identical selector to cache the results
My best chance is to manually figure out wtf are the command blocks are doing and figure out how to do that in datapacks, with predicates so its more optimized
I've noticed its using a lot of entity selectors selecting a "random" entity as a means to generate randomness, in huge Arrays of like 20 command blocks at spawn chunks
It set redstone blocks at specific locations to run other command blocks, command block lines that spread around and activate more command blocks that set "redstone_block"s to start other command blocks or "air" to stop them, it is a nightmare and 90% of them don't do anything
I have no idea how it works and why it works, but I know that I must not touch it or the map will collapse on itself
Loading...