[Benchmarks] Add performance benchmarks (1/2) #20
Conversation
Also add categories to demos and fix naming conflicts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but wait for one more
lib/data/demos.dart
Outdated
|
||
Map<Symbol, GalleryDemo> studies(GalleryLocalizations localizations) { | ||
return <Symbol, GalleryDemo>{ | ||
#shrine: GalleryDemo( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is Symbol
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was the Dart type for symbols but it's to be used for methods and members instead (https://api.flutter.dev/flutter/dart-core/Symbol/Symbol.html). I'll replace with strings
@@ -11,7 +11,7 @@ import 'package:gallery/layout/text_scale.dart'; | |||
import 'package:gallery/l10n/gallery_localizations.dart'; | |||
import 'package:gallery/studies/fortnightly/shared.dart'; | |||
|
|||
const fortnightlyTitle = 'Fortnightly'; | |||
const _fortnightlyTitle = 'Fortnightly'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be removed and use the value from demos.dart instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be a bit cumbersome to obtain so I'll leave it as is
* Create transitions_perf.dart * Add flutter_driver and test dependencies * Pass localizations instead of BuildContext to demos Also add categories to demos and fix naming conflicts * Create WIP transitions_perf_test.dart * Updates * Update transitions_perf.dart * Update pubspec.lock * Update iOS Podfile * Update project.pbxproj * Rename GalleryDemoCategory.reference to other * Allow extension methods by bumping up sdk * Update macOS Podfile * Obtain nativeLocaleNames directly * Specify category for demos instead of title * Add extension to GalleryDemoCategory to get name and display title * Add back and list value keys * Obtain demo descriptions cleanly * Add value keys to demos * studies returns a map and is used * Add more ValueKeys * Rename reference to other demos * Fix categories collapsing themselves * Delete transitions_perf_test.dart * Edit copyright * Use allGalleryDemos * Update demos.dart * Update pubspec * Name extension for it to be available globally * Use strings instead of symbols for study demos * Create pubspec.lock Co-authored-by: guidezpl <guidezpl@users.noreply.github.com> Former-commit-id: a679fa8
return LinkedHashMap<String, GalleryDemo>.fromIterable( | ||
materialDemos(context) + cupertinoDemos(context) + referenceDemos(context), | ||
allGalleryDemos(localizations), | ||
key: (dynamic demo) => demo.slug as String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guidezpl I noticed in passing that this change looks like it adds a bunch of entries to the resulting map all with a null
key. That is, allGalleryDemos
adds in the list of GalleryDemo entries produced from studies
, each of which has null
as the value of demo.slug
. The resulting map will have only a single entry for all of the studies
entries, using null
as the key. Is this intentional? Or have I somehow missed something here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Studies were implemented first, and then demos added the concept of slugs, so I think that's why it's the way it is. AFAIK studies don't actually use slugToDemo
-- task defined in the list
This PR contains
Preparation for the perf transitions test
GalleryDemoCategory
(study, material, cupertino, other)demos.dart
GalleryLocalizations
object instead of aBuildContext
describe
getter toGalleryDemo
to uniquely identify demos with the format 'demoName@demoCategory' (e.g. "Buttons@material")ValueKey
s for integration tests to identify category headers, demo lists, and demostest_driver/transitions_perf.dart
, which launches the app in English and provides uniquely identifiable demo names totransitions_perf_test.dart
Misc
Future work
In a separate PR
test_driver/transitions_perf_test.dart