Status Update
Comments
ma...@gmail.com <ma...@gmail.com>
ra...@google.com <ra...@google.com> #2
Thank you for posting.
We are currently looking into this and will get back to you as soon as we have an update.
fs...@beecorp.ai <fs...@beecorp.ai> #3
Thank you for posting.
The issue has been logged internally. Please note that we cannot give you any timelines, but you can star the issue to get notifications when the fix is released.
ma...@gmail.com <ma...@gmail.com> #4
ma...@gmail.com <ma...@gmail.com> #5
According to Google Support, Autocomplete (NEW) Requires BOTH: Places (New) API + Places Legacy to be enabled (who knows why?) -- I was instructed to enable Legacy by going to:
Once that is enabled, the Autocomplete element worked as expected when using their Sample code:
vi...@gmail.com <vi...@gmail.com> #6
Just to clarify: the issue is not specific to Vue or React. If you want to use a Places Autocomplete widget UI, there are two options:
- The
. This widget requires the alpha version of the Maps JavaScript API, and uses the Places (New) API. This is a Preview version which is not suitable for production usePreview Autocomplete widget - The
, which uses the Places API (Legacy) service.GA Autocomplete widget
Given that the new API does not yet support an Autocomplete widget as a GA feature, it is appropriate to enable the Legacy API in this case. The link to enable the Legacy API is
Once the new Autocomplete widget is GA, and the frameworks of your choice support them, it is recommended to migrate to the new Autocomplete widget.
We'll be updating the docs shortly to clarify this. Sorry for the confusion!
jc...@katapultengineering.com <jc...@katapultengineering.com> #7
ma...@gmail.com <ma...@gmail.com> #9
ia...@gmail.com <ia...@gmail.com> #10
pi...@gmail.com <pi...@gmail.com> #11
Thanks for the report #10 - would you mind filing a
ro...@gmail.com <ro...@gmail.com> #12
su...@gmail.com <su...@gmail.com> #13
ic...@gmail.com <ic...@gmail.com> #14
Map performance is bad even with as little as 100 markers. When I had the same 100 markers, but using Legacy markers - performance was just plain smooth.
Now with Advanced markers, dragging the map and zooming are stutter-y. Mind you the 100 markers are spread around, at times you might have just 1 marker visible on your screen at once and it is still bad. This leads me to believe that the DOM is just too heavy altogether.
gw...@gmail.com <gw...@gmail.com> #15
ab...@gmail.com <ab...@gmail.com> #16
jh...@google.com <jh...@google.com> #17
We are aware that Advanced Markers' performance suffers compared to legacy Markers in optimized (canvas drawing) mode, when the amount of markers is really high. Advanced Markers are best suited for situations where their advanced features are crucial, such as custom HTML & styling, interactivity, or simple use through web components; and when the number of markers remains relatively low. The threshold at which a performance hit is noticeable varies with many factors, but its order of magnitude is often 100 or 1000 markers.
While we're working on further recommendations and solutions to mitigate and address this issue, we recommend you to keep using the legacy makers in optimized mode for the time being, for use-cases with a very high number of markers.
We appreciate your patience as we continue to improve the Google Maps Platform. We'll be sure to post updates here should another recommendation be available in the future.
gw...@gmail.com <gw...@gmail.com> #18
ab...@gmail.com <ab...@gmail.com> #19
ma...@gmail.com <ma...@gmail.com> #20
Perhaps Legacy markers should not be marked Deprecated if they are a valid long term option and new markers are not yet viable/ready? Deprecation causes issues/warnings with linters and static analysis tools.
os...@sizeup.com <os...@sizeup.com> #21
The performance of older markers was suboptimal, but advanced markers are simply unsuitable for projects that aim to avoid marker clustering.
ma...@gmail.com <ma...@gmail.com> #22
And it's also the high CPU usage dom rendering requires. Since browser runs does it all in a single thread, it can easily sit at 100% core usage. The rendering itself is simply not multithreaded.
It seems the limit is at around 200 before performance starts to drop. With 2.5k markers, i get around 3.6GB memory usage and CPU is stuck at near 100% for quite a while. Map drag triggers dom updates (because positioning is by translate), yet again killing CPU.
yo...@google.com <yo...@google.com> #23
Thank you for the feedback! The team is trying to investigate the Advanced Markers performance issue, our initial focus is on scenarios involving the rendering of several hundred markers, as this represents the most common use case reported by our users.
To better assist us in our investigation efforts, we kindly request that you provide us a JSFiddle and/or the following information:
- How many Advanced Markers are you creating?
- Do you use the default Advanced Markers or custom content? Does the custom content have SVGs?
- Are you using Raster or Vector Maps?
- Do you remove the old Markers and create new Markers when panning or zooming the Map?
- What FPS, CPU and memory usages are you observing when you navigate the Map?
- If you don't use Advanced Markers, do you use the legacy Marker or the OverlayView for your use case? (This will help us compare the performances)
- Which OS and browsers are you using for testing?
Any additional code samples or details you can provide about your specific use case would be extremely helpful. This information will allow us to better understand the circumstances under which performance issues occur and guide our investigation efforts more effectively. Thank you!
ga...@zealty.ca <ga...@zealty.ca> #24
2. We use custom content but do not use SVGs. (We provide a DIV which is a portion of a PNG sprite file.)
3. We use raster maps at present but we will likely move to vector maps sometime in the near future.
4. When the map is panned or zoomed, we remove the markers that are outside the map bounds and load new ones that are within the new bounds.
6. We converted to advanced markers in June 2024. We haven't noticed a degradation in performance.
7. Our primary test environment is macOS 14.6.1 and Chrome.
Our real estate map is located at
ma...@gmail.com <ma...@gmail.com> #25
- with old markers, we allowed up to 1500 without clustering. With new ones i find 200-250 is equivalent in performance, 500 has some short freezes already and increased memory usage.
- Custom SVG/html - but overall the complex of these elements is equivalent to the default google markers - and i get similar performance drops with default markers.
- No markers are manually removed right now when testing (unless using SharedSuperClusterViewportAlgorithm - which is a fixed version that better handles out of view markers, from clustering git repo).
- With 500 markers - the tab is at around 350mb of memory (~120 without marker). CPU usage on that tab remains consistently high (chrome dev tools hovers at around 60-110, 150 when panning). If i try 1500 markers, it jumps to over 1gb memory and panning is a < 1 update/s slideshow. Likely getting limited by a single threaded nature of JS. I can get memory usage down but not keeping any local copy/array of markers, but now i have no access to them past init (due to large dom objects in each markers, the marker array itself also consumes a substantial amount of memory).
- Legacy markers for roughly similar amount (also custom SVG content), sit almost idle - 0-0.9 CPU and extra 20-40mb of ram consumed.
- Windows Chrome/Firefox. Hardware is substantially above what the average user would have (5800x3d or 12900).
Markers themselves are generated with minimal config. The content generation in total is highly optimized and the actual marker generation in code is relatively quick. For testing, using
const marker = new google.maps.marker.AdvancedMarkerElement({
position: { lat: conf.lat, lng: conf.lng },
map: this.#map,
content: await this.#getContentElement(conf),
});
Example of the dom element on screenshot - and a quick dump from chrome with 1500 markers visible.
yo...@google.com <yo...@google.com> #26
Thanks for providing the detailed description of your use cases! I can see that the custom content is a fairly complex SVG which has an inner SVG element, would you mind attaching that SVG file here for us to take a look?
Also, how do you create the legacy Markers with this SVG content? Do you pass the SVG URL or its data URI to the legacy Marker's
If you set the legacy Marker's false
, the SVG will be rasterized to a single <img> element which is much simpler than the SVG element in terms of the DOM structure, and this is what we try to determine: if using <img src="svg">
is performant with Advanced Markers, or you have a use case where you need users to interact with the inner elements of the SVG, please let us know, thank you!
ma...@gmail.com <ma...@gmail.com> #27
The *SVG elements are combined in code (the marker has three states - hover/focus/normal), the inner icon in the center can change. Markers can have different color combinations too. It is not a single reused static marker.
The legacy did use optimize. Users specifically do not interact with the inner element itself - however, in some cases it does have to allow rotation (like a directional arrow).
img src svg requires the use of data URI, which in our case may conflict with SCP.
Simplifying the marker content to just a single path element, reduced memory usage by 200-300mb for 1500 markers, and reduced cpu usage - but when panning, it was consistently above 100.
The memory cost is directly proportional to the dom size. cpu usage relates to the complexity (more elements to draw - svg filters etc) and any content updates in viewport/elements that require a redraw causes a massive spike.
Similar performance spikes also happen with default marker (the red pin). Hover or pan can spike CPU a lot. These spikes also happen when i set content to an empty <img> element. Most likely due to the frequent transforms on the parent elements.
So it seems there are two separate issues:
- the inner content raw dom adds to the memory size and extra calculations/rendering. will-change for transform in large numbers is also a potential cause for memory bloat.
- the CSS transforms to position elements (does advanced marker make use of requestAnimationFrame to sync with rendering cycle?)
I have considered potentially prerendering to canvas and running position calculations in a worker (but you can't get the actual x y position from the marker for that). Or even webgl for even more performance. Using overlays. Both relatively complex and time consuming to implement that do not justify switching away from legacy markers. And overlay based approach would further lack native clustering support.
jc...@katapultengineering.com <jc...@katapultengineering.com> #28
- Usually around 400 in a small geographic area (telephone poles on a street), but in some use cases we have up to 4000. Furthermore, clustering does not benefit our use case.
- We only use custom content and the custom content is an SVG
- We use Raster Maps, but would be open to using Vector
- We currently do create and remove markers based on the user’s map bounds, but we have also tested disabling this and either way Advanced Markers were noticeably worse than optimized Legacy Markers
- We don’t have specific metrics but even with just 400 markers there is noticeable jank and stuttering when panning and zooming the map
- Currently we use optimized Legacy Marker’s for our use case
- Our users mostly use Chrome on Windows and Android mobile devices but some use Safari on iOS
o....@gmail.com <o....@gmail.com> #29
I agree with other comments that legacy markers should not be deprecated until advanced markers can be optimized.
Our more complex markers would have used SVGs but (as others have found and has also been in discussion) I had to generate multiple versions of images, plus use another div in the advanced marker to add a separate background colour. Even using images isn't as performant as I would want it to be with advanced markers. We have also implemented clustering to mitigate some of the performance issues but this is an option that our clients can turn on and off.
So essentially, I think we need to be able to have advanced markers plotted on a canvas layer, otherwise the dom gets very heavy and memory usage is way up.
ma...@gmail.com <ma...@gmail.com> #30
The number of nodes generated even with default red pin is around 10x the number of markers. at 10k markers it's at around 100k and CPU/thread can't handle it anymore. Even if i were to try and optimize custom marker content, it would not help if even the default marker itself does not perform.
I have looked at alternatives - like maps webgl overlay. Creating SVG based markers is possible (three.js SVGLoader) - but difficul. Also, would need a complete new webgl based clustering.
Switching to DOM based as a "new future" is an architectural and engineering oversight - it is well known that DOM and JS are performance limited.
I feel like WebGl should have been the approach for AdvancedMarkers, the performance would be magnitudes ahead of what you can do with dom. But it requires much more support and support from google maps own side - including vector map layering. The vector map does not allow controlling zindex/layer order (so your markers are on top of map street names etc), orthographic camera support (so markers do not grow smaller/larger when zooming), SVG and other similar rendering support, clustering with webgl "markers" etc.
In my basic test i could render a million markers with decent performance (an example included).
ma...@gmail.com <ma...@gmail.com> #31
webgl/three.js example
va...@thedataduck.com <va...@thedataduck.com> #32
jh...@google.com <jh...@google.com> #33
We appreciate your feedback regarding the performance issues you’ve encountered with the Advanced Markers JavaScript API. While Advanced Markers are easy to use, accessible, easy to customize, we take your concerns seriously and would like to offer some suggestions as we investigate this further.
Please note that our aim is to provide you with options to help mitigate any immediate issues while ensuring that we continue the investigation in Advanced Markers JS API based on your needs and feedback.
Thank you for your understanding and continued feedback. Suggestions below.
Optimized legacy Markers (for raster maps)
For use cases involving a very high number of markers, the legacy Markers API in its optimized mode is still available. While legacy Markers are not receiving new feature updates, they are still supported and there are no plans to remove them at this time. This approach is well-suited for scenarios where performance is critical, especially when rendering numerous markers on a Raster Maps and when customizing markers with simple images or SVGs.
Data-Driven Datasets
If your use case involves creating data visualizations on Vector Maps, we suggest exploring the Data-driven Datasets API. It is designed to efficiently handle large sets of geospatial data and interactive elements and may help with your use case. You can read more at
WebGLOverlayView
If your project would benefit from more flexibility in rendering complex shapes on Vector Maps, we suggest exploring WebGLOverlayView. While it uses WebGL drawing (instead of custom HTML elements) and requires some modifications to your existing code, it can significantly improve performance and provide enhanced control over custom visuals. You can read more at
3D Maps (Experimental)
For developers who want to see our ongoing investigation and work into more performant Markers, please take a look at Marker 3D Elements on 3D Maps (currently in the experimental launch phase). You can read more at
ed...@trugreenmail.com <ed...@trugreenmail.com> #34
ch...@google.com <ch...@google.com> #35
Legacy markers will continue to work until further notice. The deprecation of legacy markers is intended to help guide people to what we think is the best option for most developers (i.e. Advanced Markers), and manage expectations on what level of support legacy markers will receive going forward. (While google.maps.Marker will continue to receive bug fixes for any major regressions, existing bugs in google.maps.Marker generally won't be addressed.)
More info available at
Description
With new markers, each builds a dom tree. If SVG-s are also part of it, the performance takes a major hit when the nr of markers increases.
With just 250 (like capitols of the world) - moving the map around is choppy and can see a spike in the CPU. A lot of rendering and transformations happening.
Rendering many visible markers at once is unavoidable. Everything can not be hidden by zoom or clustered.
Are there any plans to introduce some form of optimized rendering?