Once your models are cleaned and ready for export, you’ll want to clean your scene of detritus. A scene that has been worked up over time often contains the remnants of old models, shaders, textures, curves, and/or layers.
How to Tell if Your Scene Contains Unnecessary Nodes
In the Hypergraph, with _Input/Output Connections_ turned on, if you can visually see nodes with no connections then some are likely to be unused. Most scenes contain unused nodes regardless of cleanliness while creating scenes.
Preparing for Optimizing Scene Size
In preparing a scene, you should look through your Outliner and Hypergraph making sure that all nodes are connected properly. Clean up the Outliner by grouping appropriate transforms. If you see unused/unnecessary nodes delete them by hand to ensure their deletion.
IMPORTANT: Before continuing save a new version of the file, as Optimizing Scene Size is not an undo-able operation.
Optimizing Scene Size
After saving a new version of your scene continue on to optimizing the scene.
File > Optimize Scene Size (Options)
In this menu you can select which node types to delete and by not selecting certain types you can preserve them. The bulk of scene clutter is from Transforms, Display layers, Curves, Cached data, Deformers, GroupID nodes, Rendering nodes, and Shading networks.
After you have optimized the scene, save this file as a new version.
Testing for Errors After Optimization
To test for errors, begin by looking at the Hypergraph to make sure that connections are still held. Continue by doing some test renders, ensuring all textures are placed properly and connected. Test for animations if you have any, and make sure deformers have been preserved.