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
45a8b3db
Unverified
Commit
45a8b3db
authored
Mar 27, 2020
by
Mouad Debbar
Committed by
GitHub
Mar 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complete text layout benchmark (#53295)
parent
ac3b77bd
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
333 additions
and
24 deletions
+333
-24
bench_text_layout.dart
...hmarks/macrobenchmarks/lib/src/web/bench_text_layout.dart
+299
-11
recorder.dart
dev/benchmarks/macrobenchmarks/lib/src/web/recorder.dart
+31
-13
web_benchmarks.dart
dev/benchmarks/macrobenchmarks/lib/web_benchmarks.dart
+2
-0
web_benchmarks.dart
dev/devicelab/lib/tasks/web_benchmarks.dart
+1
-0
No files found.
dev/benchmarks/macrobenchmarks/lib/src/web/bench_text_layout.dart
View file @
45a8b3db
This diff is collapsed.
Click to expand it.
dev/benchmarks/macrobenchmarks/lib/src/web/recorder.dart
View file @
45a8b3db
...
...
@@ -268,12 +268,14 @@ abstract class WidgetRecorder extends Recorder
Stopwatch
_drawFrameStopwatch
;
@override
void
_frameWillDraw
()
{
@mustCallSuper
void
frameWillDraw
()
{
_drawFrameStopwatch
=
Stopwatch
()..
start
();
}
@override
void
_frameDidDraw
()
{
@mustCallSuper
void
frameDidDraw
()
{
profile
.
addDataPoint
(
'drawFrameDuration'
,
_drawFrameStopwatch
.
elapsed
);
if
(
profile
.
shouldContinue
())
{
...
...
@@ -321,6 +323,18 @@ abstract class WidgetBuildRecorder extends Recorder
/// consider using [WidgetRecorder].
Widget
createWidget
();
/// Called once before all runs of this benchmark recorder.
///
/// This is useful for doing one-time setup work that's needed for the
/// benchmark.
void
setUpAll
()
{}
/// Called once after all runs of this benchmark recorder.
///
/// This is useful for doing one-time clean up work after the benchmark is
/// complete.
void
tearDownAll
()
{}
@override
Profile
profile
;
...
...
@@ -331,13 +345,13 @@ abstract class WidgetBuildRecorder extends Recorder
/// Whether in this frame we should call [createWidget] and render it.
///
/// If false, then this frame will clear the screen.
bool
_
showWidget
=
true
;
bool
showWidget
=
true
;
/// The state that hosts the widget under test.
_WidgetBuildRecorderHostState
_hostState
;
Widget
_getWidgetForFrame
()
{
if
(
_
showWidget
)
{
if
(
showWidget
)
{
return
createWidget
();
}
else
{
return
null
;
...
...
@@ -345,19 +359,21 @@ abstract class WidgetBuildRecorder extends Recorder
}
@override
void
_frameWillDraw
()
{
@mustCallSuper
void
frameWillDraw
()
{
_drawFrameStopwatch
=
Stopwatch
()..
start
();
}
@override
void
_frameDidDraw
()
{
@mustCallSuper
void
frameDidDraw
()
{
// Only record frames that show the widget.
if
(
_
showWidget
)
{
if
(
showWidget
)
{
profile
.
addDataPoint
(
'drawFrameDuration'
,
_drawFrameStopwatch
.
elapsed
);
}
if
(
profile
.
shouldContinue
())
{
_showWidget
=
!
_
showWidget
;
showWidget
=
!
showWidget
;
_hostState
.
_setStateTrampoline
();
}
else
{
_profileCompleter
.
complete
(
profile
);
...
...
@@ -372,11 +388,13 @@ abstract class WidgetBuildRecorder extends Recorder
@override
Future
<
Profile
>
run
()
{
profile
=
Profile
(
name:
name
);
setUpAll
();
final
_RecordingWidgetsBinding
binding
=
_RecordingWidgetsBinding
.
ensureInitialized
();
binding
.
_beginRecording
(
this
,
_WidgetBuildRecorderHost
(
this
));
_profileCompleter
.
future
.
whenComplete
(()
{
tearDownAll
();
profile
=
null
;
});
return
_profileCompleter
.
future
;
...
...
@@ -561,7 +579,7 @@ class Profile {
buffer
.
writeln
(
'name:
$name
'
);
for
(
final
String
key
in
scoreData
.
keys
)
{
final
Timeseries
timeseries
=
scoreData
[
key
];
buffer
.
writeln
(
'
$key
:'
);
buffer
.
writeln
(
'
$key
:
(samples=
${timeseries.count}
)
'
);
buffer
.
writeln
(
' | average:
${timeseries.average}
μs'
);
buffer
.
writeln
(
' | noise:
${_ratioToPercent(timeseries.noise)}
'
);
}
...
...
@@ -613,10 +631,10 @@ abstract class RecordingWidgetsBindingListener {
Profile
profile
;
/// Called just before calling [SchedulerBinding.handleDrawFrame].
void
_
frameWillDraw
();
void
frameWillDraw
();
/// Called immediately after calling [SchedulerBinding.handleDrawFrame].
void
_
frameDidDraw
();
void
frameDidDraw
();
/// Reports an error.
///
...
...
@@ -697,8 +715,8 @@ class _RecordingWidgetsBinding extends BindingBase
if
(
_hasErrored
)
{
return
;
}
_listener
.
_
frameWillDraw
();
_listener
.
frameWillDraw
();
super
.
handleDrawFrame
();
_listener
.
_
frameDidDraw
();
_listener
.
frameDidDraw
();
}
}
dev/benchmarks/macrobenchmarks/lib/web_benchmarks.dart
View file @
45a8b3db
...
...
@@ -37,6 +37,8 @@ final Map<String, RecorderFactory> benchmarks = <String, RecorderFactory>{
BenchTextLayout
.
canvasBenchmarkName
:
()
=>
BenchTextLayout
(
useCanvas:
true
),
BenchTextCachedLayout
.
domBenchmarkName
:
()
=>
BenchTextCachedLayout
(
useCanvas:
false
),
BenchTextCachedLayout
.
canvasBenchmarkName
:
()
=>
BenchTextCachedLayout
(
useCanvas:
true
),
BenchBuildColorsGrid
.
domBenchmarkName
:
()
=>
BenchBuildColorsGrid
(
useCanvas:
false
),
BenchBuildColorsGrid
.
canvasBenchmarkName
:
()
=>
BenchBuildColorsGrid
(
useCanvas:
true
),
}
};
...
...
dev/devicelab/lib/tasks/web_benchmarks.dart
View file @
45a8b3db
...
...
@@ -24,6 +24,7 @@ Future<TaskResult> runWebBenchmark({ @required bool useCanvasKit }) async {
return
await
inDirectory
(
macrobenchmarksDirectory
,
()
async
{
await
evalFlutter
(
'build'
,
options:
<
String
>[
'web'
,
'--dart-define=FLUTTER_WEB_ENABLE_PROFILING=true'
,
if
(
useCanvasKit
)
'--dart-define=FLUTTER_WEB_USE_SKIA=true'
,
'--profile'
,
...
...
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