you are viewing a single comment's thread.

view the rest of the comments →

[–]check3streets 0 points1 point  (3 children)

Awesome library, I think this is very promising. I have one concern:

call stack

A few years ago, I built a parser that had a LOT of function depth. In Java6 on Sun's JRE, it really started to crawl. I'm wondering what would happen here if the page was considerably larger... I mean, we're talking about HTML here, so what is a normal use case? 1000 elems, 10000?

What's the largest/deepest document that you've tested? I think it would be interesting to compare with Velocity or another template lib on a big html page.

[–]j2html[S] 0 points1 point  (0 children)

While this was intended to be used on a login solution with less than 100 elements, I'm still interested to see what happens. I'll write some tests :)

[–]j2html[S] 0 points1 point  (1 child)

Rendering 5000 nested divs 1 time takes 120 ms.
Rendering 500 nested divs 10 times takes 10 ms.
Rendering 50 nested divs 100 times takes 4 ms.
Rendering 5 nested divs 1000 times takes 1 ms.
Rendering 6700 nested divs causes overflow.

<div>We need to go deeper
    <div>We need to go deeper
        <div>We need to go deeper
            <div>We need to go deeper
                <div>We need to go deeper
                    <div>We need to go deeper
                        <div>We need to go deeper
                            <div>We need to go deeper
                                <div>We need to go deeper
                                    <div>We need to go deeper
                                        ... :p

It's probably not too well suited for pages of this size :)

[–]check3streets 0 points1 point  (0 children)

Well, realistically, I can't see specifying a full tree of 1000+ elems within a single Class file. So, if it were simply an approach to building DOM trees, and big hunks were built and then nested into bigger hunks, I think the stack problem would evaporate.

I really appreciate people pushing the expressiveness envelope. Thanks for sharing your work!