Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance degradation in render time in 5.0.0 version #5070

Open
kamil-sienkiewicz-asi opened this issue Nov 19, 2024 · 5 comments · May be fixed by #5072
Open

Performance degradation in render time in 5.0.0 version #5070

kamil-sienkiewicz-asi opened this issue Nov 19, 2024 · 5 comments · May be fixed by #5072
Labels
bug Something isn't working globe Globe related issues showstopper Preventing from releasing a pre-release version as non-pre-release
Milestone

Comments

@kamil-sienkiewicz-asi
Copy link

4.7.1 render time:
image

Chrome dev tools buffer usage:

image

5.0.0-pre.6 render time:

image

Chrome dev tools buffer usage:

image

Notice how buffer differs, 47 seconds and it's almost empty vs 4 seconds and it's full. Both tests are done in mercator projection.

maplibre-gl-js version: 5.0.0-pre6 but seems like every 5.0.0 has this issue

browser: Google Chrome Version 130.0.6723.117 (Official Build) (arm64)

Steps to Trigger Behavior

  1. Open codesandbox, go to console -> performance -> start recording
  2. Move map for a second or two, stop recording
  3. Version 5.0.0 takes ~10x longer to render and fills dev tools buffer usage immediately.

Link to Demonstration

https://codepen.io/kamil-sienkiewicz-asi/pen/qBeGYaJ?editors=1010

Expected Behavior

Render time takes around ~1ms with basic layers from demotiles

Actual Behavior

Render time takes from ~9ms to ~30ms with same layers from demotiles

@HarelM HarelM added globe Globe related issues bug Something isn't working showstopper Preventing from releasing a pre-release version as non-pre-release labels Nov 19, 2024
@HarelM
Copy link
Collaborator

HarelM commented Nov 19, 2024

Thanks for taking the time to report this issue.
We'll try and look into it, but feel free to dig into it as well, we'll need any help we can get...

@HarelM
Copy link
Collaborator

HarelM commented Nov 19, 2024

CC: @ibesora @kubapelc

@birkskyum birkskyum added this to the 5.0 milestone Nov 19, 2024
@kubapelc
Copy link
Collaborator

I think this might be related to passing float64 matrices to WebGL. Almost all time is spent inside glUnifomMatrix4fv, which is very similar to what I saw when I first noticed that there is a perf difference between float32 and float64. Later I couldn't replicate it, but I guess I was only trying it in Firefox.

I will investigate further.

@kubapelc
Copy link
Collaborator

I think it was the float64 matrices, after conversion to float32 I no longer see the very fast Chrome buffer fillup and glUniformMatrix4fv no longer shows up in the profile.

@kamil-sienkiewicz-asi please confirm that the issue is also resolved on your machine. Patched demo:

https://codepen.io/kubapelc/pen/poMmZbz?editors=1010

I will create a PR if this works.

@kamil-sienkiewicz-asi
Copy link
Author

Hey @kubapelc , yep, seems like it did the trick, nice! Render time went down to ~1ms
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working globe Globe related issues showstopper Preventing from releasing a pre-release version as non-pre-release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants