Most efficient way to give custom attribute modifiers to all mobs spawning in a dimension.

I want to give all mobs that will spawn in a custom dimension custom attributes and am wondering what the best way to do it is. As far as I can tell you can't get mobs to spawn with attributes straight so I think my best option is a tick command.

Firstly I should only run it if someone is in the dimension with execute if entity @a[predicate=in_dimension] run function #tick_function_2

Then only target entities that I want with execute as @e[type=custom_list] run function #test_function

My question is whats the best way to check every entity? I could only check on per tick with @n or limit=1, will those be essentially the same for perfomrance? Should I use multiple field in the selector i.e. @e[type=custom_list, tag=!already_checked]? With using multiple things like this will the command check the first one first and move on or will it always check both for all entities (in which case a chain of functions might be better).

Continue to help post