Skip to content

Commit

Permalink
perf: only create wasm buffer if requested (#3499)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored Aug 24, 2024
1 parent 04ab9db commit a3761f9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
12 changes: 11 additions & 1 deletion build/wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ const writeWasmChunk = (path, dest) => {
const { Buffer } = require('node:buffer')
module.exports = Buffer.from('${base64}', 'base64')
const wasmBase64 = '${base64}'
let wasmBuffer
Object.defineProperty(module, 'exports', {
get: () => {
return wasmBuffer
? wasmBuffer
: (wasmBuffer = Buffer.from(wasmBase64, 'base64'))
}
})
`)
}

Expand Down
12 changes: 11 additions & 1 deletion lib/llhttp/llhttp-wasm.js

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion lib/llhttp/llhttp_simd-wasm.js

Large diffs are not rendered by default.

0 comments on commit a3761f9

Please sign in to comment.