From 9846309cf025fcdc12ecd77014c20f97f0407d04 Mon Sep 17 00:00:00 2001 From: Sigmund Cherem Date: Wed, 19 Oct 2022 01:27:41 +0000 Subject: [PATCH] [ddc] use snapshot when running worker test. The snapshot is already available in the build directory, this makes the test save up 11 times all the parse and warmup costs of loading the compiler in the VM. In aggregate, this made the test run in 5 seconds instead of 2 and half minutes on my local desktop. Change-Id: Ic0f1ef030b06467999fd0178b599de697f8ccc94 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264730 Commit-Queue: Sigmund Cherem Reviewed-by: Nate Bosch --- pkg/dev_compiler/test/worker/worker_test.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/dev_compiler/test/worker/worker_test.dart b/pkg/dev_compiler/test/worker/worker_test.dart index ea2d52be8f1..14e8b59b002 100644 --- a/pkg/dev_compiler/test/worker/worker_test.dart +++ b/pkg/dev_compiler/test/worker/worker_test.dart @@ -12,18 +12,19 @@ import 'package:test/test.dart'; Directory tmp = Directory.systemTemp.createTempSync('ddc_worker_test'); File file(String path) => File.fromUri(tmp.uri.resolve(path)); +String _resolvePath(String executableRelativePath) { + return Uri.file(Platform.resolvedExecutable) + .resolve(executableRelativePath) + .toFilePath(); +} void main() { var baseArgs = []; final executableArgs = [ - Platform.script - .resolve('../../bin/dartdevc.dart') - .toFilePath(windows: Platform.isWindows), + _resolvePath('gen/dartdevc.dart.snapshot'), '--sound-null-safety', '--dart-sdk-summary', - Uri.file(Platform.resolvedExecutable, windows: Platform.isWindows) - .resolve('ddc_outline_sound.dill') - .path + _resolvePath('ddc_outline_sound.dill'), ]; group('DDC: Hello World', () { final argsFile = file('hello_world.args');