This script is a good idea, I may make one that disables certain expressions in a comp as well.
But it would be great if you had more built-in control over how and when expressions are evaluated. Like specifying that an expression should only be evaluated once, not every frame, or only evaluated on "draft" or something like that.
The expressions engine is so incredibly powerful and useful. But it could be even moreso with a few extra features. Like globally defined funcitons, global variables, etc. And also some protection against "stack overrun" errors. Better handling of errors (so that you don't get 100 layers all erroring out their expressions) would also be nice.
"specifying that an expression should only be evaluated once"
Add a posterizeTime or if (time == 0) at the beginning of your expression
"or only evaluated on "draft" or something like that"
Use a checkbox on another layer to control whether expressions should be calculated or not.
"Better handling of errors "
add try/catch in your code
So you could do something like:
if (time == 0 && comp("...").layer("...").effect("Use Expressions")(1))
// your heavy expression
Global functions may be useful, but global variables would make thing terribly messy. Plus when you add an expression control you basically create a global variable (even though you can't set it's value).