Abstract
Web-based libraries, such as D3.js, ECharts.js, and G6.js, are widely used to generate node-link graph visualizations. However, selecting the right library often involves a trial-and-error process because performance characteristics vary significantly based on encapsulated techniques. This study conducts an empirical experiment to evaluate the performance of popular web-based libraries across hundreds of graph datasets, covering node scales from 100 to 200k and various edge-to-node ratios. The results provide application-oriented guidelines to help users select libraries based on specific efficiency requirements like time cost and frame rate.
Introduction
If you’ve ever tried to render a network graph in a browser, you’ve likely faced a "Goldilocks" dilemma. D3.js offers immense power but high complexity, while ECharts and G6.js provide user-friendly "black box" solutions. Developers often choose a library based on API ease of use, only to find that performance chokes once datasets reach significant scales.
In the paper "Graph visualization efficiency of popular web-based libraries," Zhao et al. move beyond anecdotal complaints. They provide a rigorous, empirical performance evaluation of popular web-based visualization tools, offering a roadmap for developers to choose the right library before writing a single line of code.
Methodology
The researchers evaluated seven combinations of libraries and rendering backends:
- D3.js: SVG, Canvas, and WebGL (via NetV.js).
- ECharts.js: SVG and Canvas.
- G6.js: SVG and Canvas.
The experiment standardized the "finish line" by measuring the time and frame rate required to complete 200 iterations of a standard force-directed layout. Tests were conducted on a mainstream desktop (i7-12700, RTX 3060) using 481 graph datasets. These datasets ranged from 100 to 200,000 nodes with edge-to-node ratios from 1 to 10, including complete graphs.
Performance Analysis and Key Insights
The study identified several critical performance characteristics:
The 3,000-Node Turning Point
For graphs under 3,000 nodes, most libraries perform similarly. Beyond this threshold, performance curves diverge sharply. In dense scenarios, such as complete graphs, this divergence happens even earlier as computational complexity spikes.
The Rendering Hierarchy
As expected, WebGL is the most efficient for large-scale graphs, followed by Canvas, with SVG trailing. SVG’s reliance on the Document Object Model (DOM) introduces significant maintenance overhead as node counts rise.
Library-Specific Efficiency
D3.js consistently outperformed higher-level libraries like ECharts and G6. This is attributed to D3's implementation of the Barnes-Hut approximation for calculating repulsive forces and its lower internal workflow overhead.
Key Results
The quantitative rankings for efficiency were remarkably consistent:
- Time Cost Ranking: D3-WebGL ≈ D3-Canvas > D3-SVG > G6-Canvas > ECharts-Canvas ≈ ECharts-SVG > G6-SVG.
- Maximum Scale: D3-WebGL and D3-Canvas were the only entries capable of handling 200,000 nodes within a 15-minute window.
- The WebGL Paradox: At very small scales, WebGL actually had a lower frame rate than Canvas/SVG due to the overhead of shader compilation and buffer initialization. Its true strength only emerges as the graph grows.
Conclusion
The paper concludes with application-oriented guidelines that act as a "cheat sheet" for developers. By matching node/edge counts and latency requirements (like a 30 fps target) against the provided lookup tables, developers can make informed decisions. While the study focused on static graphs and default settings, it provides a vital baseline for web-based visualization performance. Future work may explore dynamic scenarios and performance on mobile hardware.
Summary updated