Closed kicktipp closed 6 years ago
See here for changes which are needed: https://github.com/tipsy/j2html/compare/master...kicktipp:render-with-model?expand=1
I'm (pleasantly) surprised that you need this kind of performance. If you can provide a backwards compatible implementation with some test/examples to show the increased performance, I would be happy to merge it.
@kicktipp I'm planning to release a new version soon, do you want this included?
I will need a few weeks to evaluate it. Release fast, release often. So go ahead.
Am 27. November 2017 19:45:06 schrieb David notifications@github.com:
@kicktipp I'm planning to release a new version soon, do you want this included?
-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/tipsy/j2html/issues/83#issuecomment-347283382
j2html is great, easy and fast. But I think it could be even faster and consume less memory with the following approach. Maybe it is not a good idea so I am asking for feedback here first.
Take a look at this code:
This template generates the DomContent each and every time I render this page. This involves - with a bigger template - a lot of
new ContainerTag
statements (which are hidden by static imports).It would be nice to build a DomContent Tree with some self written ContainerTags first and then let it render with a model.
Therefor we need a second render method
render(Object model)
. The model is passed down the line and each Tag or Attribute can pick up its model if needed for rendering. Object would usually be a map like in Spring MVC.This way I can reuse the DomContent for each and every page. I don't need to build it and I don't need the GC to collect it.
This would be fairly easy when we add two methods to DomContent (and one method to Attribute)
If you think this is a good idea I can send a patch request.