mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

WebGL Performance Issues

Open c0 opened this issue 10 years ago • 7 comments

I've noticed a significant lag on iPads while panning. The FPS may hit 10fps.

I'm using the latest version, and it occurs when starting up this repo and when

I ran the profiler, and almost all time is spent in WebGL's drawElements (called from drawLine and drawSymbols). The example code is taking around 40ms and this repo's demo is around 270ms. To get to 60fps, this needs to run at 16ms.

screenshot 2016-06-17 16 36 59

From a small amount of research I've seen, it's recommended to batch these calls (e.g. with drawArrays).

Is there any work being done to address this?

I'm glad to help profile and provide anything you need, but I don't have any experience with WebGL.

c0 avatar Jun 17 '16 20:06 c0

We're already batching most of the drawing. I believe there's not much we can do other than general step by step performance optimizations, such as those ticketed. iPad is not a great device to do heavy WebGL rendering, because the screen size is relatively big, but the graphic capabilities are weak (at least previous generations, iPad Pro should be better).

The example code is taking around 40ms and this repo's demo is around 270ms. To get to 60fps, this needs to run at 16ms.

Can you clarify this? What are the demo and the example you're referring to? Did you measure just one frame, or panning through a certain time interval?

mourner avatar Jun 22 '16 15:06 mourner

@c0 thanks for linking working with @danswick @tristen here for next steps based on our call yesterday commented too soon :) - looks like Vlad's already commented here 👍

alinapaz avatar Jun 22 '16 20:06 alinapaz

@mourner thanks for elaborating and I'm excited to see optimizations in the works.

Here's how I got the profile for a specific frame. Please let me know if there's anything I can do to help.

panning-perf

c0 avatar Jun 23 '16 13:06 c0

@c0 thanks, good to know! Also note that the less layers the style has, the better is the performance — a simpler style always performs better, especially on mobile devices. You could try a style like Basic just to confirm.

mourner avatar Jun 23 '16 16:06 mourner

@c0 From the gif it looks like this is a profile of Mobile Safari running in the iOS Simulator? Generally profiling results from the Simulator are not at all indicative of on-device performance.

jfirebaugh avatar Jun 23 '16 16:06 jfirebaugh

@jfirebaugh Correct. I also profiled my physical iPad with similar results. drawElements is where most time is spent.

c0 avatar Jun 23 '16 17:06 c0

I opened a new issue that will hopefully help with perf https://github.com/mapbox/mapbox-gl-js/issues/2781 :)

Since there's not anything actionable and many other issues address perf. I'm going to close this out.

c0 avatar Jun 23 '16 18:06 c0