I don't quite see how moving stuff from response body to response headers makes anything faster? Maybe I misunderstood you though. But anyway this code is really not performance critical.