I have a piece of expensive debug code that I use to print some data resulting from those computations. I know that unreal removes the Print String nodes from the Shipping build, but my worry is that if I leave it there, Unreal might execute those nodes instead of deleting them. Is Unreal’s compiler (or precompiler) smart enough to remove my code from the Shipping build or should I remove it for the final build?
It will not delete it. It will just not execute it. You just must see what calculation are done before the thing is printed. Unreal can’t do that for you.
It is unclear if you are using c++ or Blueprint which makes the difference. In C++ you can mark UFUNCTIONS as “development only” which is what the print nodes are, so they will only execute in development. It is possible to let the precompiler automatically remove or add code entirely in c++ depending on what you are building. In blueprint you can’t do this for a graph of logic nodes.