The colorization is event-based--whenever a train starts moving, and even then it's a list lookup and some math to blend colors. I don't have a megabase so you'll need to test it for yourself. At 40 constant moving trains, the script time is in the noise.