-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix #1975 - improve animation fluidity and response #2922
Conversation
@adam-mapbox this works beautifully for me! |
Taking the discussion from problem (#1975 (comment)) to proposed fix here. This looks great @adam-mapbox. It's only in the iOS code, which is good because:
It basically moves from I can't speak to the
Another set of questions/comments around the 30Hz:
I think we can merge this today once we clear these up. |
@adam-mapbox and @incanus mutex is not needed to synchronize accesses to _needsDisplay since both updateFromDisplayLink (CADisplay link is created on UIThread) and invalidate are called on UI thread. We can just put the MGLAssertIsMainThread in updateFromDisplayLink as well. |
Made some minor cleanups & changes per @mb12's (accurate) comment, as well as more clearly indicating what we're doing with regard to FPS. Will do some testing on this, particularly with @tomtaylor's app. |
This is great. Do we have a similar FPS limiter on Android @ljbade? This should go in ASAP. As a future item, is there a standard way to dynamically adjust the frame rate to the maximum that can be comfortably sustained? I believe that e.g. browsers try to do 60hz, and if that is janky, drop to 30hz. |
I think we'd have to build out some FPS introspection tools manually to look at this. IMHO we should ticket this for future investigation. |
The answer to the 30 FPS question is simply that I was on an iPod Touch and it can't handle 60 FPS. As to doing automatic rate-limiting, yeah, I think it's a distinct possibility. What makes it hard in our case is that we're so dynamic (because of data and usage patterns). With rate limiting, the challenge is how to go back up. If we start at 60, we will almost always - on most devices - drop to 30 under load, and then we'll have no way to get back up to 60. Also, just visually speaking, 30 looks pretty damn good - when it's smooth (which it now is, mostly). |
Just wanted to say a public thanks to @tomtaylor for sending in his code, it helped a great deal with tracking this down! |
ec6f3c3
to
b55bd85
Compare
🎉 |
💯 thanks everyone! |
@jfirebaugh Opened Android ticket in #2931 |
I've been debugging Mapbox GL Native performance too and I found ways of improving performance that are somehow related to what was described here but not exactly implies reducing the frame rate to 30FPS. Instead, I'm throttling how frequently we update the tile state. I have a branch (not final) and I would love we someone could try it: This commit here explains on the changelog the motivation behind the throttling: |
Since this PR ticket is merged, moving @kkaefer's concerns in #2922 (comment) to #2985 for further investigation. |
No description provided.