@gertkeno I did some testing, changing global_position
to just position
in the code.
I spawned 4000 bullets and have them expand outward like a firework. (Happy New Year in advance!) The framerate I got is about 50 fps for both global_position
and position
.
If I removed _process
function completely, not defining it in the class, I got the highest framerate possible on my monitor screen which is 144 fps. From here, if I disable vsync and allow unlimited framerate, I got more than 400 fps or so, and if I look away from all the bullets, I got more than 1000 fps. But of course, then no bullets are moving
But this does imply something though. If I have a huge scene like a very big city that has thousand of nodes and if they have no _process
function, the engine will just take a bit of time to load all these nodes and resources up and should run smoothly afterward.
I also tried adding an empty _process
in:
func _process(delta: float):
pass
But having _process
defined with pass
seems to be slower than having no _process
at all. I got 100 fps here instead.
But again, this is just a little test just for fun. Having no _process
or _process
with pass
will never be the real bottleneck, but I will remove _process
from now on if I don’t need it.
But @KingGD , just in case:
global_position += velocity_vector * delta
From this one line of code. Is it possible to optimize this a bit further?
Assuming I could use C++, will it be faster? If so, how much % improvement are we talking?