@Kevin I agree with @alien4u with regards to first trying to redesign the script to be more performant. If you've already done that one possibility could be to move all your code to a scheduled script and have the user event script only trigger the scheduled script.