I don't think it's necessary to try. 

We have to worry about the performance in production, in production you should have opcache loaded, that does a great job of cleaning up the op array. There is no need to go doing the work here too ... Where opcache isn't loaded it's perfectly safe, and the _only sensible thing to assume_, that performance is not a concern.