We override buildString for performance - allowing text to not be escaped until passed in the final StringBuilder to encode it into.
An alternative way of implementing this would be to make HtmlFormat.escape return a subclass of Html with a custom buildString implementation. While this does significantly improve performance if a template needs to escape a lot of Strings, if it doesn't, performance actually goes down (measured 10%), due to the fact that the JVM can't optimise the invocation of buildString as well because there are two different possible implementations.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4