In my game i may have a table that looks like this with maybe 100 values or so
module.data = {
['Bloxy_Cola'] = {
DisplayName = 'Bloxy Cola',
Value = 20,
Weight = 100,
RarityColor = rarityColors.Common,
ViewportPosition = Vector3.new(-61.511, -1.008, -0.324),
ViewportOrientation = Vector3.new(-3.756, 47.705, 11.278)
},
['Bloxy_Cola2'] = {
DisplayName = 'Bloxy Cola2',
Value = 20,
Weight = 50,
RarityColor = rarityColors.Common,
ViewportPosition = Vector3.new(-61.511, -1.008, -0.324),
ViewportOrientation = Vector3.new(-3.756, 47.705, 11.278)
},
}
How expensive is an operation like
for dropID, dropData in module.data do
end
im sure it matters more or less depending on what you actually do with that data but how worried do i have to be about simply reading and maybe saving some of the info into vars?
1 Like
awry_y
(kitty_kat)
January 18, 2025, 12:24pm
#2
It’s not super expensive, you can loop through a table a lot of times without suffering any actual performance issue.
But, if you want to be more precautious then try looping in parallel luaU.
2 Likes
JohnsonBlu
(JohnsonBlu)
January 18, 2025, 1:01pm
#3
I haven’t truly dabbled in Parallel LuaU yet, but this resource might help!
ActorGroup is a utility module I’ve made for the purposes of doing heavy computations (such as frequent spatial queries or generating big arrays) fast by splitting it up into multiple Actors.
This module uses queues to manage workers as to not overload a single Actor with tasks when there are free Actors.
Documentation:
Constructor The constructor for ActorGroup is quite straightforward, but it can still be pretty confusing, so here I will explain it.
<a class="lightbox" href=&q…
1 Like
athar_adv
(athar_adventure)
January 18, 2025, 1:04pm
#4
Honestly exiting and entering parallel threads is more expensive than looping The tradeoff isnt worth it in this case
3 Likes
JohnsonBlu
(JohnsonBlu)
January 18, 2025, 1:05pm
#5
Ah, sorry. As I said, I don’t know much parallel, so thank you for stepping in and correcting me.
1 Like
system
(system)
Closed
February 1, 2025, 1:06pm
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.