mbostock/d3 — Issue #430: Combine all modules into d3.js.
Author: mbostock
Created: 2012-01-03 19:38:48+00:00
State: open
Labels: req

I think having separate files for separate modules is premature optimization, and it would simplify things to combine the code into a single file (d3.js). You'd still be able to make a custom build if you wanted to reduce the file size by stripping out unneeded components.

The current breakdown is this (commented / minified / zipped):

* d3.js - 129,071 / 58,427 / 19,489
* d3.csv - 2,328 / 1,078 / 550
* d3.geo - 25,648 / 10,727 / 3,214
* d3.geom - 22,089 / 7,730 / 3,215
* d3.layout - 48,281 / 17,433 / 6,488
* d3.time - 19,685 / 11,042 / 3,069

After this change:

* d3.js - 247,102 / 106,429 / 34,740

For comparison, jQuery 1.7.1 is 248,138 / 93,867 / 33,149. So we're talking ballpark the same size as the most popular JavaScript library in existence.

If you included all the files, this change would save the overhead of 5 separate requests, and save 1,285 bytes on the gzipped content.