Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
db705b81
Unverified
Commit
db705b81
authored
Aug 19, 2020
by
LongCatIsLooong
Committed by
GitHub
Aug 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore the original name of the velocity tracker microbenchmark (#64060)
parent
ce63f507
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
README.md
dev/benchmarks/microbenchmarks/README.md
+7
-0
velocity_tracker_bench.dart
.../microbenchmarks/lib/gestures/velocity_tracker_bench.dart
+16
-6
No files found.
dev/benchmarks/microbenchmarks/README.md
View file @
db705b81
...
...
@@ -13,3 +13,10 @@ flutter run --release lib/stocks/layout_bench.dart
``
`
The results should be in the device logs.
### Avoid changing names of the benchmarks
Each microbenchmark is identified by a name, for example,
"catmullrom_transform_iteration". Changing the name of an existing
microbenchmarks will effectively remove the old benchmark and create a new one,
losing the historical data associated with the old benchmark in the process.
dev/benchmarks/microbenchmarks/lib/gestures/velocity_tracker_bench.dart
View file @
db705b81
...
...
@@ -9,15 +9,25 @@ import 'data/velocity_tracker_data.dart';
const
int
_kNumIters
=
10000
;
class
TrackerBenchmark
{
TrackerBenchmark
({
this
.
name
,
this
.
tracker
});
final
VelocityTracker
tracker
;
final
String
name
;
}
void
main
(
)
{
assert
(
false
,
"Don't run benchmarks in checked mode! Use 'flutter run --release'."
);
final
BenchmarkResultPrinter
printer
=
BenchmarkResultPrinter
();
final
List
<
VelocityTracker
>
trackers
=
<
VelocityTracker
>[
VelocityTracker
(),
IOSScrollViewFlingVelocityTracker
()];
final
List
<
TrackerBenchmark
>
benchmarks
=
<
TrackerBenchmark
>[
TrackerBenchmark
(
name:
'velocity_tracker_iteration'
,
tracker:
VelocityTracker
()),
TrackerBenchmark
(
name:
'velocity_tracker_iteration_ios_fling'
,
tracker:
IOSScrollViewFlingVelocityTracker
()),
];
final
Stopwatch
watch
=
Stopwatch
();
for
(
final
VelocityTracker
tracker
in
tracker
s
)
{
final
String
trackerType
=
tracker
.
runtimeType
.
toString
(
);
print
(
'
$trackerType
benchmark...'
)
;
for
(
final
TrackerBenchmark
benchmark
in
benchmark
s
)
{
print
(
'
${benchmark.name}
benchmark...'
);
final
VelocityTracker
tracker
=
benchmark
.
tracker
;
watch
.
reset
();
watch
.
start
();
for
(
int
i
=
0
;
i
<
_kNumIters
;
i
+=
1
)
{
...
...
@@ -30,10 +40,10 @@ void main() {
}
watch
.
stop
();
printer
.
addResult
(
description:
'Velocity tracker:
$
trackerType
'
,
description:
'Velocity tracker:
$
{tracker.runtimeType}
'
,
value:
watch
.
elapsedMicroseconds
/
_kNumIters
,
unit:
'µs per iteration'
,
name:
'velocity_tracker_iteration_
$trackerType
'
,
name:
benchmark
.
name
,
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment