How to make code run faster when using a lot of lists?

I'm guessing you're using clones, right? If so, you can set a sprite local variable to the object info, and put that same list inside the (objectData) list.

Now, with this method, you need to make sure not to replace the item in (objectData), or set (my data), because this solution is going to use linked lists.

Now that we have a reference to the object's data, we can filter the (objectData) list and keep all the items that are not identical to (my data) (checking if they're identical checks for the reference in memory, not whether each item is the same).

While yes, this does mean we loop over the list twice, the first time to keep the current object's data out of the list, then second time is where we actually check for collision, it's not in vain though. I'm pretty sure keep does run much faster than the for loop, so it may not cause more lag.

If it does cause more lag, then you could try keeping the check in the main loop. Now, if you still want to use the for ((item)) in [list] block, you can still keep track of the index.

Basically you just gotta do a lot of testing with different methods to find the one that works for you. The great thing about the linked list method, is that you can delete items from (objectData), and you don't have to decrease (spawnNum) if the deleted object was above the current object.

Oh, and if the objects are clones of the same sprite, I think I have some ideas on how to speed things up even more.