Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Fix stuttering in playgrounds due to precision issue #37035

Merged
merged 2 commits into from
Oct 26, 2022

Conversation

bdero
Copy link
Member

@bdero bdero commented Oct 26, 2022

This was the oldest item on my investigation todo! Turns out float precision isn't high enough for casting from the epoch seconds double.

Before:

Screen.Recording.2022-10-26.at.3.45.17.AM.mov

After:

Screen.Recording.2022-10-26.at.3.44.26.AM.mov

@bdero bdero self-assigned this Oct 26, 2022
@@ -22,6 +24,8 @@ void PlaygroundTest::SetUp() {
}

SetupWindow(GetParam());

start_time_ = fml::TimePoint::Now().ToEpochDelta().ToSecondsF();
Copy link
Member

Choose a reason for hiding this comment

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

If you retain start_time_ as a TimeDelta (that is skip the .ToSecondsF() here), then GetSecondsElapsed() becomes (fml::TimePoint::Now().ToEpochDelta() - start_time_).ToSecondsF(), and you only have one int -> double conversion instead of two.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice, done.

@bdero bdero force-pushed the bdero/time-precision-fix branch from e2acd54 to 23808c5 Compare October 26, 2022 18:48
@bdero bdero requested a review from zanderso October 26, 2022 18:49
@bdero bdero added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 26, 2022
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 26, 2022
@auto-submit
Copy link
Contributor

auto-submit bot commented Oct 26, 2022

auto label is removed for flutter/engine, pr: 37035, due to - The status or check suite Linux Framework Smoke Tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants