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
b011ea54
Unverified
Commit
b011ea54
authored
Dec 19, 2019
by
Gary Qian
Committed by
GitHub
Dec 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass _caretPrototype to prevent cache miss (#46720)
parent
3fe66688
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
90 additions
and
2 deletions
+90
-2
common.dart
dev/benchmarks/macrobenchmarks/lib/common.dart
+1
-0
main.dart
dev/benchmarks/macrobenchmarks/lib/main.dart
+9
-0
text.dart
dev/benchmarks/macrobenchmarks/lib/src/text.dart
+22
-0
textfield_perf.dart
...enchmarks/macrobenchmarks/test_driver/textfield_perf.dart
+11
-0
textfield_perf_test.dart
...arks/macrobenchmarks/test_driver/textfield_perf_test.dart
+21
-0
textfield_perf.dart
dev/devicelab/bin/tasks/textfield_perf.dart
+14
-0
perf_tests.dart
dev/devicelab/lib/tasks/perf_tests.dart
+8
-0
text_painter.dart
packages/flutter/lib/src/painting/text_painter.dart
+2
-0
editable.dart
packages/flutter/lib/src/rendering/editable.dart
+2
-2
No files found.
dev/benchmarks/macrobenchmarks/lib/common.dart
View file @
b011ea54
...
...
@@ -9,3 +9,4 @@ const String kPostBackdropFilterRouteName = '/post_backdrop_filter';
const
String
kSimpleAnimationRouteName
=
'/simple_animation'
;
const
String
kPictureCacheRouteName
=
'/picture_cache'
;
const
String
kLargeImagesRouteName
=
'/large_images'
;
const
String
kTextRouteName
=
'/text'
;
dev/benchmarks/macrobenchmarks/lib/main.dart
View file @
b011ea54
...
...
@@ -12,6 +12,7 @@ import 'src/cubic_bezier.dart';
import
'src/cull_opacity.dart'
;
import
'src/post_backdrop_filter.dart'
;
import
'src/simple_animation.dart'
;
import
'src/text.dart'
;
const
String
kMacrobenchmarks
=
'Macrobenchmarks'
;
...
...
@@ -34,6 +35,7 @@ class MacrobenchmarksApp extends StatelessWidget {
kSimpleAnimationRouteName:
(
BuildContext
conttext
)
=>
SimpleAnimationPage
(),
kPictureCacheRouteName:
(
BuildContext
context
)
=>
PictureCachePage
(),
kLargeImagesRouteName:
(
BuildContext
context
)
=>
LargeImagesPage
(),
kTextRouteName:
(
BuildContext
context
)
=>
TextPage
(),
},
);
}
...
...
@@ -97,6 +99,13 @@ class HomePage extends StatelessWidget {
Navigator
.
pushNamed
(
context
,
kLargeImagesRouteName
);
},
),
RaisedButton
(
key:
const
Key
(
kTextRouteName
),
child:
const
Text
(
'Text'
),
onPressed:
()
{
Navigator
.
pushNamed
(
context
,
kTextRouteName
);
},
),
],
),
);
...
...
dev/benchmarks/macrobenchmarks/lib/src/text.dart
0 → 100644
View file @
b011ea54
// 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
TextPage
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
return
Column
(
children:
<
Widget
>[
Container
(
width:
200
,
height:
100
,
child:
const
TextField
(
key:
Key
(
'basic-textfield'
),
),
),
],
);
}
}
dev/benchmarks/macrobenchmarks/test_driver/textfield_perf.dart
0 → 100644
View file @
b011ea54
// 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_driver/driver_extension.dart'
;
import
'package:macrobenchmarks/main.dart'
as
app
;
void
main
(
)
{
enableFlutterDriverExtension
();
app
.
main
();
}
dev/benchmarks/macrobenchmarks/test_driver/textfield_perf_test.dart
0 → 100644
View file @
b011ea54
// 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_driver/flutter_driver.dart'
;
import
'package:macrobenchmarks/common.dart'
;
import
'util.dart'
;
void
main
(
)
{
macroPerfTest
(
'textfield_perf'
,
kTextRouteName
,
driverOps:
(
FlutterDriver
driver
)
async
{
final
SerializableFinder
textfield
=
find
.
byValueKey
(
'basic-textfield'
);
driver
.
tap
(
textfield
);
// Caret should be cached, so repeated blinking should not require recompute.
await
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
5000
));
},
);
}
dev/devicelab/bin/tasks/textfield_perf.dart
0 → 100644
View file @
b011ea54
// 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
'dart:async'
;
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
.
android
;
await
task
(
createTextfieldPerfTest
());
}
dev/devicelab/lib/tasks/perf_tests.dart
View file @
b011ea54
...
...
@@ -156,6 +156,14 @@ TaskFunction createBasicMaterialCompileTest() {
};
}
TaskFunction
createTextfieldPerfTest
(
)
{
return
PerfTest
(
'
${flutterDirectory.path}
/dev/benchmarks/macrobenchmarks'
,
'test_driver/textfield_perf.dart'
,
'textfield_perf'
,
).
run
;
}
/// Measure application startup performance.
class
StartupTest
{
...
...
packages/flutter/lib/src/painting/text_painter.dart
View file @
b011ea54
...
...
@@ -170,6 +170,8 @@ class TextPainter {
void
markNeedsLayout
()
{
_paragraph
=
null
;
_needsLayout
=
true
;
_previousCaretPosition
=
null
;
_previousCaretPrototype
=
null
;
}
/// The (potentially styled) text to paint.
...
...
packages/flutter/lib/src/rendering/editable.dart
View file @
b011ea54
...
...
@@ -365,7 +365,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
final
Offset
startOffset
=
_textPainter
.
getOffsetForCaret
(
TextPosition
(
offset:
_selection
.
start
,
affinity:
_selection
.
affinity
),
Rect
.
zero
,
_caretPrototype
,
);
// TODO(justinmc): https://github.com/flutter/flutter/issues/31495
// Check if the selection is visible with an approximation because a
...
...
@@ -381,7 +381,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
final
Offset
endOffset
=
_textPainter
.
getOffsetForCaret
(
TextPosition
(
offset:
_selection
.
end
,
affinity:
_selection
.
affinity
),
Rect
.
zero
,
_caretPrototype
,
);
_selectionEndInViewport
.
value
=
visibleRegion
.
inflate
(
visibleRegionSlop
)
...
...
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