Skip to content

updatePaintArrays got really slow on geojson with lots of paint properties #13674

Description

@sboivinsystra

mapbox-gl-js version

v3.21, v3.24.0

Browser and version

firebox 151.0.2

Expected behavior

Hi.
I have a geojson Line layer with many paint properties. (line-color, line-opacity, line-width, line-blur). There are also expression on those ex:

'line-color': ['case', ['boolean', ['feature-state', 'select'], false], '#87FFF3',
['case', ['has', 'route_color'],
['concat', '#', ['get', 'route_color']],'#4b88fa']],

when i update a paint property it's now really slow
map.setPaintProperty('my-layer', 'line-opacity', 0.5);

It now take 3600ms while it took 400ms before v3.21.

The function "updatePaintArrays" looks to be the problem.

I tested i bit and The slowdown seems to only happen when there are expressions in the paint properties. Like mapbox now have to reevaluate every expression on every geojson features when I change the opacity.

here are screenshots of the firefox's performance flameGraphs. issue is still present on v3.24.0
v3.21
Image

v.3.20
Image

thank you!

Actual behavior

No response

Link to the demonstration

No response

Steps to trigger the unexpected behavior

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐞performance ⚡Speed, stability, CPU usage, memory usage, or power usage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions