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
e6920662
Unverified
Commit
e6920662
authored
Mar 30, 2021
by
Kaushik Iska
Committed by
GitHub
Mar 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test to exercise multiple async microtasks in frame workload (#79163)
parent
4a2ff649
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
129 additions
and
0 deletions
+129
-0
common.dart
dev/benchmarks/macrobenchmarks/lib/common.dart
+1
-0
main.dart
dev/benchmarks/macrobenchmarks/lib/main.dart
+9
-0
animation_with_microtasks.dart
...ks/macrobenchmarks/lib/src/animation_with_microtasks.dart
+74
-0
animation_with_microtasks_perf_test.dart
...arks/test_driver/animation_with_microtasks_perf_test.dart
+16
-0
animation_with_microtasks_perf_ios__timeline_summary.dart
...animation_with_microtasks_perf_ios__timeline_summary.dart
+12
-0
perf_tests.dart
dev/devicelab/lib/tasks/perf_tests.dart
+11
-0
prod_builders.json
dev/prod_builders.json
+6
-0
No files found.
dev/benchmarks/macrobenchmarks/lib/common.dart
View file @
e6920662
...
...
@@ -20,6 +20,7 @@ const String kMultiWidgetConstructionRouteName = '/multi_widget_construction';
const
String
kHeavyGridViewRouteName
=
'/heavy_gridview'
;
const
String
kSimpleScrollRouteName
=
'/simple_scroll'
;
const
String
kStackSizeRouteName
=
'/stack_size'
;
const
String
kAnimationWithMicrotasksRouteName
=
'/animation_with_microtasks'
;
const
String
kScrollableName
=
'/macrobenchmark_listview'
;
...
...
dev/benchmarks/macrobenchmarks/lib/main.dart
View file @
e6920662
...
...
@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import
'common.dart'
;
import
'src/animated_placeholder.dart'
;
import
'src/animation_with_microtasks.dart'
;
import
'src/backdrop_filter.dart'
;
import
'src/color_filter_and_fade.dart'
;
import
'src/cubic_bezier.dart'
;
...
...
@@ -56,6 +57,7 @@ class MacrobenchmarksApp extends StatelessWidget {
kHeavyGridViewRouteName:
(
BuildContext
context
)
=>
const
HeavyGridViewPage
(),
kSimpleScrollRouteName:
(
BuildContext
context
)
=>
const
SimpleScroll
(),
kStackSizeRouteName:
(
BuildContext
context
)
=>
const
StackSizePage
(),
kAnimationWithMicrotasksRouteName:
(
BuildContext
context
)
=>
const
AnimationWithMicrotasks
(),
},
);
}
...
...
@@ -192,6 +194,13 @@ class HomePage extends StatelessWidget {
Navigator
.
pushNamed
(
context
,
kStackSizeRouteName
);
},
),
ElevatedButton
(
key:
const
Key
(
kAnimationWithMicrotasksRouteName
),
child:
const
Text
(
'Animation With Microtasks'
),
onPressed:
()
{
Navigator
.
pushNamed
(
context
,
kAnimationWithMicrotasksRouteName
);
},
),
],
),
);
...
...
dev/benchmarks/macrobenchmarks/lib/src/animation_with_microtasks.dart
0 → 100644
View file @
e6920662
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
class
AnimationWithMicrotasks
extends
StatefulWidget
{
const
AnimationWithMicrotasks
({
Key
key
})
:
super
(
key:
key
);
@override
_AnimationWithMicrotasksState
createState
()
=>
_AnimationWithMicrotasksState
();
}
class
_AnimationWithMicrotasksState
extends
State
<
AnimationWithMicrotasks
>
{
final
_ChunkedWork
work
=
_ChunkedWork
();
@override
void
initState
()
{
super
.
initState
();
work
.
start
();
}
@override
void
dispose
()
{
work
.
cancel
();
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
const
Scaffold
(
backgroundColor:
Colors
.
grey
,
body:
Center
(
child:
SizedBox
(
width:
200
,
height:
100
,
child:
LinearProgressIndicator
(),
),
),
);
}
}
class
_ChunkedWork
{
bool
_canceled
=
false
;
Future
<
void
>
start
()
async
{
// Run 100 pieces of synchronous work.
// Chunked up to allow frames to be drawn.
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
_chunkedSynchronousWork
();
}
}
void
cancel
()
{
_canceled
=
true
;
}
Future
<
void
>
_chunkedSynchronousWork
()
async
{
while
(!
_canceled
)
{
// Yield to the event loop to let engine draw frames.
await
Future
<
void
>.
delayed
(
Duration
.
zero
);
// Perform synchronous computation for 1 ms.
_syncComputationFor
(
const
Duration
(
milliseconds:
1
));
}
}
void
_syncComputationFor
(
Duration
duration
)
{
final
Stopwatch
sw
=
Stopwatch
()..
start
();
while
(!
_canceled
&&
sw
.
elapsed
<
duration
)
{}
}
}
dev/benchmarks/macrobenchmarks/test_driver/animation_with_microtasks_perf_test.dart
0 → 100644
View file @
e6920662
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:macrobenchmarks/common.dart'
;
import
'util.dart'
;
void
main
(
)
{
macroPerfTest
(
'animation_with_microtasks_perf'
,
kAnimationWithMicrotasksRouteName
,
pageDelay:
const
Duration
(
seconds:
1
),
duration:
const
Duration
(
seconds:
10
),
);
}
dev/devicelab/bin/tasks/animation_with_microtasks_perf_ios__timeline_summary.dart
0 → 100644
View file @
e6920662
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_devicelab/tasks/perf_tests.dart'
;
import
'package:flutter_devicelab/framework/adb.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
Future
<
void
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
ios
;
await
task
(
createAnimationWithMicrotasksPerfTest
());
}
dev/devicelab/lib/tasks/perf_tests.dart
View file @
e6920662
...
...
@@ -151,6 +151,17 @@ TaskFunction createBackdropFilterPerfTest({bool measureCpuGpu = true}) {
).
run
;
}
TaskFunction
createAnimationWithMicrotasksPerfTest
(
{
bool
measureCpuGpu
=
true
})
{
return
PerfTest
(
'
${flutterDirectory.path}
/dev/benchmarks/macrobenchmarks'
,
'test_driver/run_app.dart'
,
'animation_with_microtasks_perf'
,
measureCpuGpu:
measureCpuGpu
,
testDriver:
'test_driver/animation_with_microtasks_perf_test.dart'
,
saveTraceFile:
true
,
).
run
;
}
TaskFunction
createBackdropFilterPerfE2ETest
(
)
{
return
PerfTest
.
e2e
(
'
${flutterDirectory.path}
/dev/benchmarks/macrobenchmarks'
,
...
...
dev/prod_builders.json
View file @
e6920662
...
...
@@ -942,6 +942,12 @@
"task_name"
:
"mac_tool_integration_tests_3_3"
,
"flaky"
:
false
},
{
"name"
:
"Mac_ios animation_with_microtasks_perf_ios__timeline_summary"
,
"repo"
:
"flutter"
,
"task_name"
:
"mac_ios_animation_with_microtasks_perf_ios__timeline_summary"
,
"flaky"
:
false
},
{
"name"
:
"Mac_ios backdrop_filter_perf_ios__timeline_summary"
,
"repo"
:
"flutter"
,
...
...
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