kleisauke / wasm-vips

libvips for the browser and Node.js, compiled to WebAssembly with Emscripten.
https://kleisauke.github.io/wasm-vips/
MIT License
512 stars 26 forks source link

incredibly slow load times #85

Open not-nullptr opened 2 days ago

not-nullptr commented 2 days ago

hello! i'm loading wasm-vips in a web worker and using postMessage to do some file conversions. it sends a message when the Vips promise (ie what's returned from the default export function) is resolved, but this can take upwards of 15 to 20 seconds. the file is cached so no idea why its taking so long? very happy to do any troubleshooting if this is unintended

kleisauke commented 2 days ago

An initialization time of ~20 seconds seems unusual. Which browser was this tested on? Does disabling the dynamic modules help?:

const vips = await Vips({
  // Optimize startup time by disabling the dynamic modules
  dynamicLibraries: []
});
not-nullptr commented 2 days ago

tested on firefox -- this seems to fix it, load times are now instant. thanks! (not closing this for now because 20 seconds seems like an awfully long time with dynamic modules?)

kleisauke commented 2 days ago

On my 8-year-old(!) laptop, initialization takes about 3 seconds in Firefox when I visit: https://wasm-vips.kleisauke.nl/playground/?modules=jxl-heif

Do you see a successful load for vips-jxl.wasm and vips-heif.wasm in the network tab? If not, it could suggest a bundler issue.