Skip to content

Conversation

@gnprice
Copy link
Member

@gnprice gnprice commented Feb 13, 2023

This is the further scroll_overlay enhancement I mentioned at #13 (comment) .

It produces a display that looks like this:

or this screen recording, from flutter/flutter#120420 (comment) :

before-norestarts.mp4

This PR also includes several changes to make the measurements more stable. The numbers had been jumping around, which becomes a lot more visible with the visual display.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sharing on all 3 for consistency: I was so very excited to see #13 that I forgot myself and made an error, actually 2. I should have sought a second reviewer on the PR as is our review guidelines. And I should have ensured tests were included, or that test exemption had been granted. 😅

Can you add a test for this PR? It ensures we do not end up removing your change accidentally. :)

@gnprice
Copy link
Member Author

gnprice commented Feb 14, 2023

And I should have ensured tests were included, or that test exemption had been granted. 😅

Can you add a test for this PR? It ensures we do not end up removing your change accidentally. :)

Does the test requirement apply to the platform_tests repo? From the linked part of the wiki, it sounds like it may not:

Every change in the flutter/engine, flutter/flutter, flutter/plugins, and flutter/packages repos must be tested, except for PRs that: […]

And there doesn't appear to be any existing tests for this app, or for ios_widget_catalog_compare. The third app in the repo, tabs_overlay, has a smoke test (which does seem like a good idea) but no more than that.

So it seems like the practice within this repo may be to mostly not have tests. Which I think is pretty reasonable, for the purpose these apps have, though a smoke test for each app would probably be helpful.


Oh, and I just spotted that that wiki section also says this:

A bot will comment on your PR if you need an explicit exemption. Do not land a PR that has had such a message from the bot unless it has an explicit exemption from Hixie! The message tells you how to ask for an exemption (please don't just cc Hixie on the PR, he won't see it).

So given that the bot hasn't commented here, I think that testing requirement really is meant to not apply to this repo.

Which I think means that it's just the PR template that is a bit misleading due to having been copied from the main repo. (The template definitely hasn't been carefully adjusted to fit this repo, because some of the other items don't really fit either: e.g. Tree Hygiene, as I think this repo isn't part of the Flutter build.)

@Piinks
Copy link
Contributor

Piinks commented Feb 14, 2023

Yeah I too noticed the inconsistencies, I am following up with the infra team to see if our bot just overlooks this repo intentionally or not. The bot ensures multiple compliances are met before code is merged, so it could be that it really should be enabled here.

It is always good to have a test that prevents your change from being reverted, perhaps a smoke test will suffice here to make sure it still runs. I have in the past returned to this tool and found it broken.

I'll follow up with what I find out about the template/bot mix up here. https://discord.com/channels/608014603317936148/608021351567065092/1075106318538518558

@gnprice
Copy link
Member Author

gnprice commented Feb 14, 2023

Fair enough. I'll add a quick test.

@gnprice
Copy link
Member Author

gnprice commented Feb 14, 2023

Added a test for the new VelocityOverlay widget; PTAL.

Also fixed up some things that were needed in order for it to work in tests. One was pretty puzzling:
7dcd876 Add Expanded on number labels
but I found a reasonable enough workaround.

Another was telling me that the velocityTimer member was no longer needed after these changes and can be removed:
749440d Cut now-unused velocityTimer
so that was a nice small cleanup.

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for yak shaving! This also LGTM, but there are merge conflicts from the other PR landing

@gnprice
Copy link
Member Author

gnprice commented Feb 16, 2023

Great, thanks!

Will rebase and resolve those conflicts, here and on #16.

This makes it a bit easier to see what's happening when the
numbers are rapidly changing during scrolling.
At 30 per second, the rate evenly divides common display frame rates
of 60, 90, or 120 fps.  This produces much smoother measurements
because most measurements now reflect the same number of frames.
The timer doesn't guarantee firing at exactly the requested times,
and in practice it doesn't.  Measuring the velocity by taking the
real difference in offset compared to the nominal difference in time
adds quite a lot of noise to the result, producing a large flicker
in the visual velocity indicators.

Instead, measure the actual time.
Even when measuring based on the real time, if we take measurements
on a periodic timer then the results show an occasional flicker
because the new offset is recomputed once per frame, and so
occasionally an interval sees one more or fewer updates than usual
because it just barely covers a new frame at both ends or just barely
misses one at each end.

Instead, check in just after each frame.

This pretty much eliminates flicker in the display of the Flutter
velocity.
This avoids an error when running in the test framework, where the
row with "Difference" was overflowing.
@gnprice
Copy link
Member Author

gnprice commented Feb 16, 2023

Done.

@Piinks Piinks merged commit 8c33eda into flutter:master Feb 16, 2023
@gnprice gnprice deleted the pr-measurement branch February 17, 2023 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants