Avoid heap allocation when calculating size with encoding
We can just declare the content on the stack