[Git][ghc/ghc][master] 2 commits: Revert "wasm: add brotli compression for ghci browser mode"

Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 42a18960 by Cheng Shao at 2025-09-14T21:30:26-04:00 Revert "wasm: add brotli compression for ghci browser mode" This reverts commit 731217ce68a1093b5f9e26a07d5bd2cdade2b352. Benchmarks show non-negligible overhead when browser runs on the same host, which is the majority of actual use cases. - - - - - e6755b9f by Cheng Shao at 2025-09-14T21:30:26-04:00 wasm: remove etag logic in ghci browser mode web server This commit removes the etag logic in dyld script's ghci browser mode web server. It was meant to support caching logic of wasm shared libraries, but even if the port is manually specified to make caching even relevant, for localhost the extra overhead around etag logic is simply not worth it according to benchmarks. - - - - - 1 changed file: - utils/jsffi/dyld.mjs Changes: ===================================== utils/jsffi/dyld.mjs ===================================== @@ -291,7 +291,7 @@ const isNode = Boolean(globalThis?.process?.versions?.node); // factor out browser-only/node-only logic into different modules. For // now, just make these global let bindings optionally initialized if // isNode and be careful to not use them in browser-only logic. -let fs, http, path, require, stream, util, wasi, ws, zlib; +let fs, http, path, require, stream, wasi, ws; if (isNode) { require = (await import("node:module")).createRequire(import.meta.url); @@ -300,9 +300,7 @@ if (isNode) { http = require("http"); path = require("path"); stream = require("stream"); - util = require("util"); wasi = require("wasi"); - zlib = require("zlib"); // Optional npm dependencies loaded via NODE_PATH try { @@ -561,30 +559,8 @@ args.rpc.opened.then(() => main(args)); }[path.extname(p)] || "application/octet-stream" ); - const buf = Buffer.from(await fs.promises.readFile(p)); - const etag = `sha512-${Buffer.from( - await crypto.subtle.digest("SHA-512", buf) - ).toString("base64")}`; - - res.setHeader("ETag", etag); - - if (req.headers["if-none-match"] === etag) { - res.writeHead(304); - res.end(); - return; - } - - res.setHeader("Content-Encoding", "br"); - res.writeHead(200); - res.end( - await util.promisify(zlib.brotliCompress)(buf, { - params: { - [zlib.constants.BROTLI_PARAM_QUALITY]: - zlib.constants.BROTLI_MIN_QUALITY, - }, - }) - ); + fs.createReadStream(p).pipe(res); return; } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/77deaa7ad9c880410b7d0a967b03739... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/77deaa7ad9c880410b7d0a967b03739... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)