From d9ff4eccb50d87da9338333c90e3082bebd065c8 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Thu, 3 Oct 2019 21:23:29 +1000 Subject: Async compiler processing (#3043) Basically this does pre-processing of TypeScript files and gathers all the dependencies asynchronously. Only then after all the dependencies are gathered, does it do a compile, which at that point all the dependencies are cached in memory in the compiler, so with the exception of the hard coded assets, there are no ops during the compilation. Because op_fetch_source_files is now handled asynchronously in the runtime, we can eliminate the tokio_util::block_on() which was causing the increase in threads. Benchmarking on my machine has shown about a 5% improvement in speed when dealing with compiling TypeScript. Still a long way to go, but an improvement. In theory the module name resolution and the fetching of the source files could be broken out as two different ops. This would prevent situations of sending the full source file all the time when actually the module is the same module referenced by multiple modules, but that could be done subsequently to this. --- cli/tests/error_004_missing_module.ts.out | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'cli/tests/error_004_missing_module.ts.out') diff --git a/cli/tests/error_004_missing_module.ts.out b/cli/tests/error_004_missing_module.ts.out index c2a0d0208..7a5f50938 100644 --- a/cli/tests/error_004_missing_module.ts.out +++ b/cli/tests/error_004_missing_module.ts.out @@ -2,11 +2,4 @@ [WILDCARD]dispatch_json.ts:[WILDCARD] at DenoError ([WILDCARD]errors.ts:[WILDCARD]) at unwrapResponse ([WILDCARD]dispatch_json.ts:[WILDCARD]) - at sendSync[WILDCARD] ([WILDCARD]dispatch_json.ts:[WILDCARD]) - at fetchSourceFiles ([WILDCARD]compiler.ts:[WILDCARD]) - at _resolveModules ([WILDCARD]compiler.ts:[WILDCARD]) - at resolveModuleNames ([WILDCARD]compiler.ts:[WILDCARD]) - at resolveModuleNamesWorker ([WILDCARD]typescript.js:[WILDCARD]) - at resolveModuleNamesReusingOldState ([WILDCARD]typescript.js:[WILDCARD]) - at processImportedModules ([WILDCARD]typescript.js:[WILDCARD]) - at findSourceFile ([WILDCARD]typescript.js:[WILDCARD]) + at sendAsync[WILDCARD] ([WILDCARD]dispatch_json.ts:[WILDCARD]) -- cgit v1.2.3