@@ -228,7 +228,7 @@ var markerFeature = function (arg) {
228228 // Find markers inside the bounding box
229229 idx = m_rangeTree . range ( min . x , min . y , max . x , max . y ) ;
230230
231- idx . sort ( ( a , b ) => a - b ) ;
231+ idx = Uint32Array . from ( idx ) . sort ( ) ;
232232 // Filter by circular region
233233 idx . forEach ( function ( i ) {
234234 var d = data [ i ] ,
@@ -353,16 +353,20 @@ var markerFeature = function (arg) {
353353 } ;
354354 // Find markers inside the bounding box. Only these could be in the polygon
355355 idx = m_rangeTree . range ( min . x , min . y , max . x , max . y ) ;
356- // sort by index
357- idx . sort ( ( a , b ) => a - b ) ;
356+ /* sort by index. This had been
357+ * idx.sort((a, b) => a - b);
358+ * but this requires continual casting from int to str and back, so using
359+ * a Uint32Array is faster, though potentially limits the maximum number of
360+ * markers. */
361+ idx = Uint32Array . from ( idx ) . sort ( ) ;
358362 // filter markers within the polygon
359363 idx . forEach ( function ( i ) {
360364 var d = data [ i ] ;
361365 let p = m_this . position ( ) ( d , i ) ;
362- let rad = radius ( data [ i ] , i ) ,
363- swz = scaleWithZoom ( data [ i ] , i ) ;
364- const so = strokeOffset ( data [ i ] , i ) ,
365- s = swz ? strokeWidth ( data [ i ] , i ) : 0 ;
366+ let rad = radius ( d , i ) ,
367+ swz = scaleWithZoom ( d , i ) ;
368+ const so = strokeOffset ( d , i ) ,
369+ s = swz ? strokeWidth ( d , i ) : 0 ;
366370 let ris = radiusIncludesStroke ( d , i ) ;
367371 ris = ris === undefined ? true : ris ;
368372 const rwos = ris ? rad + s * ( so - 1 ) / 2 : rad ; // radius without stroke
0 commit comments