-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
Description
Hi,
while I'm aware that numbers in
M0.123456,0.123456L1.123456,1.123456L1.123456,0.123456Z
are used internally by the browser to calculate shapes, it seems weird to me the we really need 1e-6
pixel precision. I'm wondering if reducing numbers precision in path strings can enhance DOM performances because of shorter d
strings to be parsed.
This function:
(pathString, precision) => pathString.replace(/\d+\.\d+/g, s => parseFloat(s).toFixed(precision))
works well, but parsing the path
string seems a waste of CPU cycles: maybe it'd be better passing a precision
option to path.toString() and process all floats with f => f.toFixed(precision)
before creating the output string.
In that case it would be nice to have d3.geoPath.precision([digits]) too.
What do you think about it?
Thanks!
mahish, David-Desmaisons, Anemy, hftf, g12n and 8 more
Metadata
Metadata
Assignees
Labels
No labels