Allow users to provide an onOptimize hook.