Optimized final height calculation