Mark Ku's Blog

Problem

In some cases, certain pages need to display a large amount of data at once and users do not want pagination. But because the dataset is so big, the rendering and execution can momentarily freeze the browser or make it stop responding.

Root cause

After investigating the example above repeatedly, here is what I found:

  • The page jank comes from rendering too much DOM at the same time.
  • Too many DOM nodes on a single page will also stutter on lower-spec computers or phones.
  • Because our frontend framework is Vue, more components mean more Virtual DOM. Whenever the data changes, components may also be triggered to re-render.

Solutions

1. Time-sliced rendering - since the jank is caused by rendering too much DOM at once, we can use setTimeout to render in batches.

  • The downside: while setTimeout makes the initial paint feel fast, you can immediately see the first screen of data on every refresh, but when you scroll fast, the page will flicker or briefly go white.

2. Scroll-based rendering (lazy loading) - render a few more rows each time the scrollbar moves.

  • Lazy loading is not the same as a virtual list / virtual scrollbar. A virtual list only renders the rows in the visible range each time.
  • When the dataset is large, it still ends up rendering too much DOM and the browser stutters.
  • Even though there are a thousand rows, the scrollbar only grows as you scroll down, so the bar's proportion looks off and is awkward to drag. FIFA club ranking table with full-height scrollbar

3. Segmented rendering - based on the row count and item height, build a virtual scrollbar. Render only the visible range; rows beyond it do not produce extra DOM. Here is a summary of the options for segmented scrolling:

  1. Clusterize.js library
  2. Virtual scrolling (Vue-virtual-scroller) library
  3. Vue virtual list component Sample link
  4. Build your own paginated rendering component

Takeaways

Given our situation - a sports score-comparison site where the client did not want pagination but needed 1000-2000 matches displayed at once - segmented rendering ended up being the recommended approach.

About infinite scroll: the frontend was crazy about infinite scroll for a while, but it does not actually fit most situations. It can work well for social networks, but not for general scenarios. Today, fewer sites still rely on infinite scroll.

  • Users have a hard time finding their target.
  • Bad for accessibility.
  • Bad for SEO.
  • Position drifts when navigating back.

Extras

  1. Additional rendering optimizations
  • Shrink object size and strip unnecessary properties (Limit unnecessary data passing).
  • Filter out data you do not need.
  • Render Once - if part of a component's content never changes, use the v-once directive so that piece renders only once.

References

Reference link Reference link Reference link Reference link Reference link Reference link

Author

Mark Ku

擁有 10+ 年經驗的資深軟體工程師,現為 AI 應用 Builder,專注於大型平台架構與簡化複雜系統設計,從電商系統到訂閱與收費平台,結合 AI Agent、AI 整合與自動化開發,打造高效率且可持續演進的產品技術基礎。Read More

Found this useful?

The author's free tools, daily podcasts and newsletter are all here.

Mark Ku · This article is licensed under CC BY 4.0. Credit the author and link back to the original when reusing it.

Comments

Subscribe to Newsletter

Subscribe to get new posts delivered instantly — never miss a tech share.

By submitting, you agree to receive emails. You can anytime.

Popular Posts

View all
Mark Ku
··602

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution
Mark Ku
··492

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.
Mark Ku
··334

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki
Mark Ku
··268

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning
Mark Ku
··218

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1
Mark Ku
··217

Setting Up Samba on Ubuntu to Share Folders with Windows 11

Setting Up Samba on Ubuntu to Share Folders with Windows 11