From 2192c149e298a2a4fc135bb1a36bafee4a462398 Mon Sep 17 00:00:00 2001 From: Diego Frias Date: Fri, 26 Jul 2024 13:46:31 -0700 Subject: [PATCH] LibWasm: Stop using `ConstrainedStream` for function parsing Speeds up spidermonkey.wasm instantiation by around 20ms (260ms -> 240ms) --- Userland/Libraries/LibWasm/Parser/Parser.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWasm/Parser/Parser.cpp b/Userland/Libraries/LibWasm/Parser/Parser.cpp index de838ed978e..5fccd867544 100644 --- a/Userland/Libraries/LibWasm/Parser/Parser.cpp +++ b/Userland/Libraries/LibWasm/Parser/Parser.cpp @@ -1257,11 +1257,9 @@ ParseResult CodeSection::Code::parse(Stream& stream) return with_eof_check(stream, ParseError::InvalidSize); size_t size = size_or_error.release_value(); - auto constrained_stream = ConstrainedStream { MaybeOwned(stream), size }; - // Emprically, if there are `size` bytes to be read, then there's around // `size / 2` instructions, so we pass that as our size hint. - auto func = TRY(Func::parse(constrained_stream, size / 2)); + auto func = TRY(Func::parse(stream, size / 2)); return Code { static_cast(size), func }; }