Server‑side duplicate filtering vs client‑side conditional rendering for large Thymeleaf alert lists
0 reputation · 17 Jan 2023, 07:42 UTC
When rendering a notification list that may contain thousands of alerts, the team must decide whether to remove duplicate alert IDs on the server using #lists.contains before the template runs, or to keep the full list in the model and rely on th:if to suppress duplicates in the view. The server‑side filter adds a collection traversal that grows with list size, while the client‑side approach pushes the conditional logic into Thymeleaf’s per‑element evaluation, which also incurs overhead for each iteration. Both methods must preserve the original alert order and respect timezone‑aware timestamps produced by #dates.format. The decision impacts rendering latency, memory usage, and the risk of stale duplicates if the underlying data changes after the model is built.
Which strategy yields lower template‑rendering time for a list of 10,000 alerts? Does th:if combined with th:switch introduce nondeterministic ordering in Thymeleaf 3.0+? How can the team verify that timestamps remain consistent across JVM time‑zone settings without adding per‑alert ZoneId objects?