Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP, not for submit: benchmark analyzer-based generation #3788

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions _test/bin/benchmark.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import 'dart:io';

import '../test/common/utils.dart';

Future<void> main() async {
// only works in test
inTest = false;
ensureCleanGitClient();
print('Initial build.');
await runBuild();
print('Done.');

print('Files,Build time/ms,Incremental time/ms');
for (final size in [
100,
500,
1000,
1500,
2000,
2500,
3000,
3500,
4000,
4500,
5000,
]) {
stdout.write('$size,');

await createFile(
'lib/bv_app.dart',
[
for (var i = 0; i != size; ++i) "import 'built_value${i + 1}.dart';",
].join('\n'),
);

for (var i = 0; i != size; ++i) {
await createFile('lib/built_value${i + 1}.dart', '''
import 'package:built_value/built_value.dart';

import 'bv_app.dart';

part 'built_value${i + 1}.g.dart';

abstract class Value implements Built<Value, ValueBuilder> {
Value._();
factory Value([void Function(ValueBuilder)? updates]) = _\$Value;
}
''');
}
final stopwatch = Stopwatch()..start();
await runBuild();
stdout.write('${stopwatch.elapsedMilliseconds},');

await createFile('lib/built_value1.dart', '''
import 'package:built_value/built_value.dart';

import 'bv_app.dart';

part 'built_value1.g.dart';

abstract class Value implements Built<Value, ValueBuilder> {
int get x;
Value._();
factory Value([void Function(ValueBuilder)? updates]) = _\$Value;
}
''');
stopwatch.reset();
await runBuild();
print(stopwatch.elapsedMilliseconds);
}
}
10 changes: 10 additions & 0 deletions _test/lib/built_value1.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import 'package:built_value/built_value.dart';



part 'built_value1.g.dart';

abstract class Value implements Built<Value, ValueBuilder> {
Value._();
factory Value([void Function(ValueBuilder)? updates]) = _$Value;
}
65 changes: 65 additions & 0 deletions _test/lib/built_value1.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions _test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ environment:
sdk: ^3.6.0

dependencies:
built_value: ^8.9.0
web: ^1.0.0

dev_dependencies:
Expand All @@ -18,6 +19,7 @@ dev_dependencies:
build_runner_core: any
build_test: any
build_web_compilers: any
built_value_generator: ^8.9.0
dart_flutter_team_lints: ^3.1.0
io: ^1.0.0
path: ^1.8.0
Expand Down
Loading
Loading