Skip to content

Reduce bundle size by removing dependency on d3-interpolate #26

@atepoorthuis

Description

@atepoorthuis

The current (unminified, uncompressed) UMD bundle size is 85kb, which isn't bad to begin with. 20kb of that is earcut which is essential, but another 16kb (18% of total bundle size) is for d3-interpolate and the d3-color dep that comes with it. All of the color definitions etc. end up in the bundle as well 😞

This is because we heavily use this function https://github.com/d3/d3-interpolate/blob/master/src/value.js which allows for interpolation of all kinds of things, including color, and the way it's written the color, string etc. stuff can't be tree-shaken. We only need to interpolate numbers and arrays (of numbers) so could probably just write our own version of https://github.com/d3/d3-interpolate/blob/master/src/number.js combined with https://github.com/d3/d3-interpolate/blob/master/src/array.js. It would probably increase performance too since it removes an unnecessary type check for every interpolation. @luucvanderzee thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions