tipsy / j2html

Java to HTML generator. Enjoy typesafe HTML generation.
https://j2html.com/
Apache License 2.0
765 stars 136 forks source link

Performance tuning #197

Open obecker opened 3 years ago

obecker commented 3 years ago

The performance of the rendering process can be improved by

I'm not sure if this can be realized in a backward compatible way - so probably this is something for 2.0

sembler commented 3 years ago

I like this idea. I'd take it further for the Indenter and say that we don't need to pass in the text anymore. We'd just need to represent the indentation itself: Indentation.append(int level, Appendable out) since the text can be appended by the caller at some point in the future.

I think it is worth focusing on 2.0 right now; to clean away the deprecated items and fix the API difficulties that we've come to recognize over the past few months.

obecker commented 3 years ago

I'd take it further for the Indenter and say that we don't need to pass in the text anymore. We'd just need to represent the indentation itself: Indentation.append(int level, Appendable out) since the text can be appended by the caller at some point in the future.

Yes, definitely. Otherwise it would be difficult to combine the two aspects (the indented text needs also to be escaped).

Concerning the TextEscaper: another possibility would be to wrap or decorate the given Appendable by an EscapingAppendable when writing text contents and attribute values.