#What are the most computationally expensive events to use?
1 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
That question is reletively difficult to answer as there's no "expensive" event.
It's about what code you run inside of that event
and the amount of calls it gets
which varies a lot thorugh gameplay
You don't really need to worry that much about Startup events and events that run only once per world join
If you're using any tick event it may make sense to only actually run your code every second
that's what I'm doing for a project I'm making rn, it's running some quite expensive code, every second and as such it allows abouit 500+ blocks to be placed that run these expensive functions.
also if possible use java functions instead of js custom code ?
so instead of if(item.id == "myid") do item.is("myid")
imo it's more important to write performant and good code then not using specific events
also in combination to this, make sure to split up your execution between multiple ticks, so instead of using level.tick use entity.age
So for this I usually do something like if (item.id != "myid") return
Is that pretty decent?
I will benchmark if it's actually faster to use .is instead of doing js equals