SINTEF-9012 / PruneCluster

Fast and realtime marker clustering for Leaflet
MIT License
551 stars 133 forks source link

Memory leak or performance bug? #66

Open meliborn opened 9 years ago

meliborn commented 9 years ago

Live example: I have ajax request after page load

pruneCluster = new PruneClusterForLeaflet()
$.getJSON $('#real_estate_search').attr('action') + ".json?" + $('#real_estate_search').serialize(), (response) ->
        pruneCluster.RemoveMarkers()
        map.removeLayer pruneCluster
        $.each response, (key, estate) ->
          marker = new PruneCluster.Marker(estate.latitude, estate.longitude)
          marker.data.popup = estate.content_for_marker
          marker.data.popupOptions = {maxWidth: 250, closeButton: false, keepInView: false}
          pruneCluster.RegisterMarker(marker)
        map.addLayer pruneCluster

So what the problem? I have ~40k markers. First time, when page loads it take ~10s to render it. But when I load page second time it render pretty fast (1s). I debugged it, and I'm pretty sure, that this is not waiting for request, it's js runtime. Any ideas?

fungiboletus commented 9 years ago

Hi, It's strange. Can you check where the time is spent? Using Chrome's Debugger, you can "Collect JavaScript CPU Profile" (Profiles tab') for example.

meliborn commented 9 years ago

fungiboletus commented 9 years ago

85% of the time is spent in (idle). Can you check in the network panel that it's not the ajax request which takes 10s to load the first time?