{"action":"created","issue":{"url":"https://api.github.com/repos/Leaflet/Leaflet/issues/3972","labels_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/3972/labels{/name}","comments_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/3972/comments","events_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/3972/events","html_url":"https://github.com/Leaflet/Leaflet/issues/3972","id":113959282,"number":3972,"title":"successive calls to testLayer.addData() slow down considerably","user":{"login":"philFL","id":15371605,"avatar_url":"https://avatars.githubusercontent.com/u/15371605?v=3","gravatar_id":"","url":"https://api.github.com/users/philFL","html_url":"https://github.com/philFL","followers_url":"https://api.github.com/users/philFL/followers","following_url":"https://api.github.com/users/philFL/following{/other_user}","gists_url":"https://api.github.com/users/philFL/gists{/gist_id}","starred_url":"https://api.github.com/users/philFL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philFL/subscriptions","organizations_url":"https://api.github.com/users/philFL/orgs","repos_url":"https://api.github.com/users/philFL/repos","events_url":"https://api.github.com/users/philFL/events{/privacy}","received_events_url":"https://api.github.com/users/philFL/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-10-29T01:20:38Z","updated_at":"2015-10-30T00:03:10Z","closed_at":null,"body":"Hi, \r\n\r\nI have a function that is in a timer which runs every 5 seconds.  \r\nFor the sake of this test, the geojsonFeature is static.  \r\nIn the real program the data will be changing.  \r\n\r\nIn any event, after about the 10th time the timer runs, the time that it takes for the addData function to complete takes longer and longer.  There are about 13 features in the geojsonFeatures, which are pretty much duplicates of this first entry...(I didn't show all of it here to save space)\r\n\r\n```js\r\nvar geojsonFeature = [{\r\n        \"type\": \"Feature\",\r\n        \"properties\": {\r\n            \"name\": \"Coors Field\",\r\n            \"amenity\": \"Baseball Stadium\",\r\n            \"popupContent\": \"This is where the Rockies play!\"\r\n        },\r\n        \"geometry\": {\r\n            \"type\": \"Point\",\r\n            \"coordinates\": [-105.99404, 39.75621]\r\n        }\r\n    },\r\n```\r\n    \r\nThe time starts out at about 30ms, but pretty quickly grows to the hundreds of milliseconds.  I do not understand why.  I am just using the latest leaflet 0.7.7 included as follows:\r\n\r\n```html\r\n    <!-- LEAFLET Libraries -->\r\n     <link rel=\"stylesheet\" href=\"http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css\" />\r\n    <script>L_PREFER_CANVAS = true;</script>\r\n    <script src=\"http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js\"></script>\r\n```\r\nThe PREFER_CANAS setting doesn't seem to help, but I tried it based on other posts.\r\n\r\nSample Code:\r\n\r\n```js\r\n    var time1;\r\n    var time2;\r\n    if (testLayer != null) {\r\n        testLayer.clearLayers();\r\n        time1 = Date.now();\r\n        testLayer.addData(geojsonFeature);\r\n        time2 = Date.now();\r\n    }\r\n    else {\r\n        time1 = Date.now();\r\n        testLayer = L.geoJson(geojsonFeature).addTo(map);\r\n        time2 = Date.now();\r\n    }\r\n    var msg = '<br/>test' + ' time add to map: ' + (time2 - time1);\r\n    $('#info span').append(msg);\r\n```\r\n\r\nPerhaps I am missing something obvious.  Any help will be greatly appreciated."},"comment":{"url":"https://api.github.com/repos/Leaflet/Leaflet/issues/comments/152361074","html_url":"https://github.com/Leaflet/Leaflet/issues/3972#issuecomment-152361074","issue_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/3972","id":152361074,"user":{"login":"danzel","id":393086,"avatar_url":"https://avatars.githubusercontent.com/u/393086?v=3","gravatar_id":"","url":"https://api.github.com/users/danzel","html_url":"https://github.com/danzel","followers_url":"https://api.github.com/users/danzel/followers","following_url":"https://api.github.com/users/danzel/following{/other_user}","gists_url":"https://api.github.com/users/danzel/gists{/gist_id}","starred_url":"https://api.github.com/users/danzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danzel/subscriptions","organizations_url":"https://api.github.com/users/danzel/orgs","repos_url":"https://api.github.com/users/danzel/repos","events_url":"https://api.github.com/users/danzel/events{/privacy}","received_events_url":"https://api.github.com/users/danzel/received_events","type":"User","site_admin":false},"created_at":"2015-10-30T00:03:10Z","updated_at":"2015-10-30T00:03:10Z","body":"It reproduces in IE11, left it running over lunch and now it takes a second to add and remove the layer, will check it out."}}