Permalink
Browse files

Profiling the move operations to see where I could optimize for safari

  • Loading branch information...
1 parent 585c845 commit 23baf010c78abfa89c302d5ef3d2f6eeb0a79623 @jrstarke jrstarke committed Jul 30, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 victoria-transit.coffee
View
14 victoria-transit.coffee
@@ -84,13 +84,20 @@ if Modernizr.svg and Modernizr.inlinesvg
@prevNumStops = @stops.length
@prevZoom = @zoomLevel()
- # We clustered the stops if they're within 10 pixels, do the same for the radiuses
+ # We clustered the stops if they're within 10 pixels, do the same for the stop layer
+ start = new Date()
@clusters = @cluster(@stops,10)
-
+ console.log "Clustering stop distances: " + (new Date() - start)
+
+ start = new Date()
@localClusters = @filter(@clusters,@distanceInPixels())
+ console.log "Filtering Stop distances: " + (new Date() - start)
+
if (not @prevLocalClusters) or @prevLocalClusters != @localClusters
@prevLocalClusters = @localClusters
# Add new incoming circles
+
+ start = new Date()
marker = @selector.selectAll("g").data(@localClusters)
marker.enter().append("g")
.append("circle").attr("class", "reach").attr('r', @distanceInPixels())
@@ -100,8 +107,11 @@ if Modernizr.svg and Modernizr.inlinesvg
#Do this to all remaining circles
@updateCircleRadius()
+ console.log "Stop Distance updating: " + (new Date() - start)
+ start = new Date()
@selector.selectAll("g").attr("transform", (cluster) => @transform cluster[0])
+ console.log "Stop Distance move: " + (new Date() - start)
distanceInMeters = (if $.cookie("distance") then $.cookie("distance") else 500) # (private) assume you can walk 500m in 6min, this seems to be a good default distance
distanceInMeters: () ->

0 comments on commit 23baf01

Please sign in to comment.