alt.hn

5/19/2025 at 10:33:02 AM

Making iText's table rendering faster

https://kb.itextpdf.com/itext/how-i-made-pdf-table-rendering-faster

by whizzx

5/26/2025 at 1:56:26 AM

Always love optimization posts.

A few things caused some confusion while reading the post.

For the first 50,000 cells flame graph, the post identifies two methods as the main time sinks, com.itextpdf.layout.renderer.TableBorderUtil#createAndFillBorderList and com.itextpdf.layout.renderer.CollapsedTableBorders#getCollapsedList.

I looked for those two methods in the flame graph and couldn't find them.

Only when I realized that the flamegraph had truncated the full method names to show just the method name, did the graph make sense.

I think circling in red (or whatever high contrast colour you want) the method names in the flame graph would've made drawing attention to them much quicker.

The second problem is a display problem.

The third table, displaying the results of post-optimization for collapsed table borders only displays three columns on Firefox (hiding the fourth column, containing the post-optimization runtimes). If the user moves the mouse over the table, then the horizontal scrollbar for the table appears, hinting that there's more data hidden off the right end of the table.

The third quibble I have with the post is the display of large numbers in the tables. Actually the last table fixed the problem, using '_' as a thousands digit separator. If that change could be applied to the other tables in the post, that'd make discerning the differences in runtimes easier.

Thanks

by canucker2016

5/22/2025 at 1:41:03 AM

It's funny that iText is still around. I used this 20 years ago in a hybrid .NET/Java web app that needed a PDF renderer and it was pretty much the top choice. The rendering still looks the same!

by mmastrac

5/22/2025 at 1:51:43 AM

Heading compaction buried the lede: "made rendering faster" vs "made rendering 95% faster".

Dear @dang, may we have the "95%" back?

by nine_k

5/22/2025 at 1:58:36 AM

It's standard practice to take those kinds of numbers out of title, because they make the title more baity, and often cause much of the discussion to focus on debate about how accurate/normal the figure is. It's sufficient for the title to say "faster" then let the article demonstrate how much faster it can be in different scenarios.

by tomhow

5/22/2025 at 2:12:17 AM

But there is a qualitative difference between 5% faster and 95% faster: the latter usually meaning a serious rework, and the former being a small incremental improvement.

I'd be okay with replacing "95% faster" with "several times faster" to still convey the point.

by nine_k

5/22/2025 at 2:22:19 AM

It's not about the size of the number or improvement; we do the same thing when the number is "10,000%", which is not unusual in the titles we see here.

The problem with these kinds of titles – and this is no comment on this particular article (I haven't checked, because it's irrelevant) – is that sometimes writers will put a figure in the title that was achieved in a one-off result under very specific/unusual conditions, whereas the realistic improvement under more normal conditions is like 20% or 50% – still great, just not what the title claimed.

Then when that happens, the discussion becomes dominated by comments pointing that out and debating the validity of the tests and results – even if the article does a good job of revealing those details.

We've found we can reduce that effect by taking the numbers out of the title altogether.

by tomhow

5/21/2025 at 11:44:16 PM

[flagged]

by comrade1234