-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP, not for submit: benchmark analyzer-based generation / incrementa…
…l generation by number of files.
- Loading branch information
1 parent
998d544
commit d8e42bf
Showing
5 changed files
with
251 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.