{"action":"created","issue":{"url":"https://api.github.com/repos/d3/d3-path/issues/10","repository_url":"https://api.github.com/repos/d3/d3-path","labels_url":"https://api.github.com/repos/d3/d3-path/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/d3/d3-path/issues/10/comments","events_url":"https://api.github.com/repos/d3/d3-path/issues/10/events","html_url":"https://github.com/d3/d3-path/issues/10","id":190334779,"number":10,"title":"Reduce the precision of numbers in path strings?","user":{"login":"mindrones","id":1309648,"avatar_url":"https://avatars.githubusercontent.com/u/1309648?v=3","gravatar_id":"","url":"https://api.github.com/users/mindrones","html_url":"https://github.com/mindrones","followers_url":"https://api.github.com/users/mindrones/followers","following_url":"https://api.github.com/users/mindrones/following{/other_user}","gists_url":"https://api.github.com/users/mindrones/gists{/gist_id}","starred_url":"https://api.github.com/users/mindrones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mindrones/subscriptions","organizations_url":"https://api.github.com/users/mindrones/orgs","repos_url":"https://api.github.com/users/mindrones/repos","events_url":"https://api.github.com/users/mindrones/events{/privacy}","received_events_url":"https://api.github.com/users/mindrones/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-11-18T14:40:43Z","updated_at":"2017-01-26T12:05:50Z","closed_at":null,"body":"Hi,\r\n\r\nwhile I'm aware that numbers in \r\n`M0.123456,0.123456L1.123456,1.123456L1.123456,0.123456Z`\r\nare 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. \r\n\r\nThis function:\r\n```js\r\n(pathString, precision) => pathString.replace(/\\d+\\.\\d+/g, s => parseFloat(s).toFixed(precision))\r\n```\r\nworks well, but parsing the `path` string seems a waste of CPU cycles: maybe it'd be better passing a `precision` option to [path.toString()](https://github.com/d3/d3-path#path_toString) and process all floats with `f => f.toFixed(precision)` before creating the output string.\r\nIn that case it would be nice to have [d3.geoPath](https://github.com/d3/d3-geo#geoPath).precision([digits]) too.\r\n\r\nWhat do you think about it?\r\nThanks!\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/d3/d3-path/issues/comments/275373270","html_url":"https://github.com/d3/d3-path/issues/10#issuecomment-275373270","issue_url":"https://api.github.com/repos/d3/d3-path/issues/10","id":275373270,"user":{"login":"mindrones","id":1309648,"avatar_url":"https://avatars.githubusercontent.com/u/1309648?v=3","gravatar_id":"","url":"https://api.github.com/users/mindrones","html_url":"https://github.com/mindrones","followers_url":"https://api.github.com/users/mindrones/followers","following_url":"https://api.github.com/users/mindrones/following{/other_user}","gists_url":"https://api.github.com/users/mindrones/gists{/gist_id}","starred_url":"https://api.github.com/users/mindrones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mindrones/subscriptions","organizations_url":"https://api.github.com/users/mindrones/orgs","repos_url":"https://api.github.com/users/mindrones/repos","events_url":"https://api.github.com/users/mindrones/events{/privacy}","received_events_url":"https://api.github.com/users/mindrones/received_events","type":"User","site_admin":false},"created_at":"2017-01-26T12:05:50Z","updated_at":"2017-01-26T12:05:50Z","body":"By the way I've noticed a couple of things in Chrome.\r\n\r\nLarge `d` strings make debugging DOM elements pretty slow (plus, it won't let you edit their `d` attribute), so hopefully shorter strings will improve performances, at least while debugging.\r\n\r\n![screen shot 2016-12-02 at 14 47 16](https://cloud.githubusercontent.com/assets/1309648/20836339/2d91eade-b89f-11e6-9446-10c19c165cca.png)\r\n\r\nBy inspecting the `d` attribute, it would seem that internally it rounds numbers to the 3rd digit, or they just format numbers in that panel for readability.\r\n\r\n![screen shot 2016-12-02 at 14 48 04](https://cloud.githubusercontent.com/assets/1309648/20836395/6b46ad4c-b89f-11e6-9ddc-d419ee780598.png)"}}
{"actor":{"display_login":"mindrones"}}