mapbox / mapbox/mapbox-gl-js

CPU usage seems higher on v2.4.1 than v1.13.1 across all major browsers on Mac and Windows

Open
#10,951 2 comments 1 reaction 1 assignee Claimed by @SnailBones View on GitHub
needs investigation :mag: performance :zap:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: 1.13.1 and 2.4.1

**browser**: Firefox 91, Chrome 92, Edge 93, and Safari 14.1.1 on Mac OS 11.4 and Windows 10

### Steps to Trigger Behavior

1. Visit the demonstration links
2. Use browser tools to view tab-specific CPU usage
3. Note that the CPU usage on the v2 example is generally higher (with the specific amount varying somewhat by browser)

### Link to Demonstration

I made a demo where I'm calling setData on a source every 100ms to update the information for about 700 features. This is more frequently than we actually update data in our app that focuses on realtime location information about vehicle fleets, but I wanted to make the difference in CPU usage easy to notice.

v1: https://codesandbox.io/s/mapbox-gl-js-v1-performance-tkp6d
v2: https://codesandbox.io/s/mapbox-gl-js-v2-performance-t02u5

### Expected Behavior

Given the release notes for the v2.x releases, I expected v2 to be less CPU intensive than v1 or remain steady

### Actual Behavior

Here're reasonably representative samples of what I'm seeing on my Macbook Pro 16:

Browser
v1
v2
Increase

Safari
80%
130%
50%

Edge
43%
62%
19%

Firefox
36%
47%
11%

Chrome
15%
18%
3%

safari-mac
edge-mac
firefox-mac
chrome-mac

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.