How to Loop Through Large Arrays More Efficiently?

I have an array with about 7000 array elements. I’m currently using a for each loop to loop through the array. I also have 3 other arrays of equal length to the array being looped through. I’m using a get node with these 3 other arrays alongside the current index in the for each loop so that I can access the element at the same index of each of the 4 arrays at once. When the for each loop triggers, I get about a second or two of visible lag. Is there a more efficient way to access the same index of these 4 large arrays?

Generally (in blueprint) the engine just won’t let you.

In c++ you probably want to create a separate thread for the loop to occur in.

A possibly viable BP alternative is to use tick to manually loop the values; every tick you look at a different value (instead of trying to look up all the values in 1 tick).

As far as accessing an index, you just need the number of the index.

If that number is obtained during a loop you are subject to lag / the loop process.

If you handle that number separately, you wouldn’t necessarily be tied to anything other than the process you use to determine that index.
This is common for stuff like foliage. The engine will return the Index off a trace for instance. (Usually true for any HISM).

If you want performance, just stick to creating your own async thread for the loop process/index getting system.