I remember using Sonic Worlds a lot when I used to use MMF2!
Looking at this capx reminds me EXACTLY of the layout of the events from the MMF2 Sonic Worlds.
Not that I'm exactly genius on all of this, but I can see a lot of events that are very badly optimised (the same things jayderyu picked up on).
Mostly avoid repeated Collision checks. I know it's difficult to sparse collisions, but some checks aren't necessary, such as, whilst Sonic is moving right (XSpeed>0), it's not really needed to check the "Left" sensor if it's overlapping a wall (Sure, it could create problems such as if a moving wall was coming towards sonic whilst he's moving right slowly, it may not push him, but I'm thinking "Basic" Sonic engine :P )
"Every Tick" with lots of math involving Sin and Cos, probably is a bit overly taxing on the CPU (Even general calculators lag for seconds when you do multiple sin calculations in one go), I guess to avoid that though is a bit complicated, as Sonic needs to detect stuff constantly as he's running.
I haven't got time to analyse or write any more right now :( but I hope I gave some sort of useful insight!