Stars-Beyond / Horizon-Community-Edition

An easily scalable game server
Apache License 2.0
7 stars 4 forks source link

profile code with samply #60

Closed tristanpoland closed 1 week ago

tristanpoland commented 1 week ago

Image

a lot of time is being spent iterating through a Vec

WilliamAnimate commented 1 week ago

looking into it further, this code seems to be part of terraforge::space::simulate

there are two ways i can think of mitigating this: use what instructions the CPU is capable of, so it spends less time in the iterator (in the update_position function) parallelize the iterator with rayon

of course, these can be combined.

WilliamAnimate commented 1 week ago

looking into it further, this code seems to be part of terraforge::space::simulate

there are two ways i can think of mitigating this: use what instructions the CPU is capable of, so it spends less time in the iterator (in the update_position function) parallelize the iterator with rayon

of course, these can be combined.

rn_image_picker_lib_temp_0e4ae1ea-4db2-44cc-862c-7605aa33cf71.jpg

sizable performance improvement on my end from commit 273b986 on my machine. for reference, it used to take 1.6 seconds

note: I had to go into the code and add the space module back and call the function, as it was removed

tristanpoland commented 1 week ago

@WilliamAnimate This ended up being merged correct?

WilliamAnimate commented 1 week ago

@WilliamAnimate This ended up being merged correct?

yes, however, this commit removes the space::simulate call which means my new code isn't being called.

tristanpoland commented 1 week ago

@WilliamAnimate This ended up being merged correct?

yes, however, this commit removes the space::simulate call which means my new code isn't being called.

Thanks bud, ill take a look into getting that re-added later on in Terraforge's development, Odds are the orbit functionality will be migrated