Improve extruded polygon and wall performance.

This PR only slightly improves the performance. A few percent here and there but not enough to mention numbers. Most of this PR is removing temporary object creation by using scratch variables.