js-markerwithlabel icon indicating copy to clipboard operation
js-markerwithlabel copied to clipboard

Performance is extremely slow, browser is freezing, why?

Open hoogw opened this issue 3 years ago • 5 comments

I add 200 labels, browser seems freezing, I click reload button, refresh button on browser menu, it reload after 10 seconds. obviously 200 labels make browser not responsive.

any advise?

hoogw avatar May 05 '21 17:05 hoogw

i know why is slow, 200 marker with lable generate 200 overlay views,

to make it fast, how can i make 200 lable share only one overlay view?

hoogw avatar May 07 '21 02:05 hoogw

if i draw 200 lines, i can draw 200 line in one polyline, fast

if i draw 200 line use 200 new polyline object, it will be slow

hoogw avatar May 07 '21 02:05 hoogw

what is the zIndex means?

                       `  var new_marker_label = new MarkerWithLabel({

                              icon: " ",  // an empty string will hide the icon, only shows labels   
                              
                              position: ___position,

                              clickable: false,  // must set false, otherwise, can not use mouse to pan map, due to this marker label shade, only trigger marker click-drag event, pan map event will not trigger
                              draggable: false,  // must set false, otherwise, can not use mouse to pan map, due to this marker label shade, only trigger marker click-drag event, pan map event will not trigger

                              zIndex: 0,   // does not help, we want to all label in one single overlay view, instead of each label for a seperate overlay view.
                                           // all label in a single over lay view, should have best performance, each label in a seperate overlay view will slow down performance 

                              map: map,

                              labelContent: "<div style='font-size:" + ___zoomScale[current_zoom] +  "px'>" + ____text + "</div>", // can also be HTMLElement

                              //labelAnchor: new google.maps.Point(-90, -45),   // make sure label at center of marker, must set anchor as offset,  
                              labelAnchor: new google.maps.Point(label_anchor_offset_vertical_y, label_anchor_offset_horizontal_x), 

                              labelClass: "labels", // the CSS class for the label
                              labelStyle: { opacity: ___opacity },  // opacity is NOT working, instead, you can set opacity statically in labelClass: "labels", // the CSS class for the label, color: rgba(0,0,0,0.5);  /*  label text color  */
                              visable: false

                          })`

hoogw avatar May 07 '21 03:05 hoogw

I createa 200 label with 200 new_marker_label = new MarkerWithLabel({.....})

I believe this will create 200 labels with 200 seperated overlay view.

That result in very low performance.

I decide to set zIndex to a fixed number, such as 999.

try to make 200 label use single overlay view, to speed up performance, however, it is same result, very slow.

hoogw avatar May 07 '21 03:05 hoogw

We are having an similar issue with about 80 labels at the exact same position. It loops through all labels stacking the next on top which causes 80 * 80 action calls. The whole process takes about 5 seconds to complete which causes a flickering of the markers.

Nicola-Widmer avatar Sep 27 '21 11:09 Nicola-Widmer