I’m afraid this comes down to low level optimizations.
One simple thing you can do is implement your own Function (see doc 11 on how to do it). That will allow you to keep only a minimal set of intermediary variables. But that means that you will have to reimplement the backward of your function by hand.