From 26e6888d235645e993a9f870d597612412d28faf Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 18 Mar 2021 15:12:28 -0700 Subject: wasm-emscripten-finalize: Do not read the Names section when not writing output (#3698) When not writing output we don't need debug info, as it is not relevant for our metadata. This saves loading and interning all the names, which takes several seconds on massive inputs. This is possible in principle in other tools, but this does not change anything in them for now. (We do use names internally in some nontrivial ways without opting in to it, so that would require further refactoring. Also the other tools almost always do write an output.) This is not 100% unobservable. If validation fails then the validation error would just contain the function index instead of the name from the Names section if there is one. However finalize does not validate atm so that would only matter if we change that later. --- src/wasm/wasm-io.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/wasm/wasm-io.cpp') diff --git a/src/wasm/wasm-io.cpp b/src/wasm/wasm-io.cpp index f2c5af6db..42eb9ab46 100644 --- a/src/wasm/wasm-io.cpp +++ b/src/wasm/wasm-io.cpp @@ -50,6 +50,7 @@ void ModuleReader::readBinaryData(std::vector& input, std::string sourceMapFilename) { std::unique_ptr sourceMapStream; WasmBinaryBuilder parser(wasm, input); + parser.setDebugInfo(debugInfo); parser.setDWARF(DWARF); parser.setSkipFunctionBodies(skipFunctionBodies); if (sourceMapFilename.size()) { -- cgit v1.2.3