-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update meshopt_decoder module to latest #24491
Conversation
This brings up meshopt_decoder modules to the latest versions, which mostly constitutes a few internal Wasm changes that get reflected in the different Wasm blobs, and support for Web Workers. Note that with this change, GLTFLoader will start using decodeGltfBufferAsync path but by default that still uses the same flow (so no change!). However, this allows the application to call MeshoptDecoder.useWorkers(4); ... to activate asynchronous geometry decoding. It's expected that the better default is to not use WebWorkers, but using them can be beneficial for very large files or very latency-sensitive applications. Some size/perf stats: old decoder (0.14 from before this change): - .js 21414 bytes - .js.gz 5745 bytes new decoder: - .js 24850 bytes (+16%) - .js.gz 6442 bytes (+12%) - 3-4% faster decoding in Chrome - support for Web Workers (which is where most of the size impact comes from!) new decoder with worker support stripped (not part of this PR!): - .js 22715 bytes (+6%) - .js.gz 5831 bytes (+1%) - 3-4% faster decoding in Chrome I'm currently expecting that the extra ~700 bytes of download cost is Not A Big Deal, and that size-conscious applications use webpack which may or may not be able to strip Web Worker support out if that is not used...
In general we've found it harder than expected to get dead code eliminated by build tools reliably, and I suspect the detection conditions here are not obvious enough for most build tools. If (in the future) you are looking for a more reliable way to include optional functionality that won't increase bundle size for clients who don't use it, without publishing multiple npm packages, the use of import { MeshoptDecoder } from 'meshoptimizer/worker'; But I definitely agree that 700 bytes for web worker support is reasonable, and personally wouldn't bother with additional modules or workarounds in this case. |
Thanks! |
This brings up meshopt_decoder modules to the latest versions, which mostly constitutes a few internal Wasm changes that get reflected in the different Wasm blobs, and support for Web Workers. Note that with this change, GLTFLoader will start using decodeGltfBufferAsync path but by default that still uses the same flow (so no change!). However, this allows the application to call MeshoptDecoder.useWorkers(4); ... to activate asynchronous geometry decoding. It's expected that the better default is to not use WebWorkers, but using them can be beneficial for very large files or very latency-sensitive applications. Some size/perf stats: old decoder (0.14 from before this change): - .js 21414 bytes - .js.gz 5745 bytes new decoder: - .js 24850 bytes (+16%) - .js.gz 6442 bytes (+12%) - 3-4% faster decoding in Chrome - support for Web Workers (which is where most of the size impact comes from!) new decoder with worker support stripped (not part of this PR!): - .js 22715 bytes (+6%) - .js.gz 5831 bytes (+1%) - 3-4% faster decoding in Chrome I'm currently expecting that the extra ~700 bytes of download cost is Not A Big Deal, and that size-conscious applications use webpack which may or may not be able to strip Web Worker support out if that is not used...
This brings up meshopt_decoder modules to the latest versions, which mostly constitutes a few internal Wasm changes that get reflected in the different Wasm blobs, and support for Web Workers. Note that with this change, GLTFLoader will start using decodeGltfBufferAsync path but by default that still uses the same flow (so no change!). However, this allows the application to call MeshoptDecoder.useWorkers(4); ... to activate asynchronous geometry decoding. It's expected that the better default is to not use WebWorkers, but using them can be beneficial for very large files or very latency-sensitive applications. Some size/perf stats: old decoder (0.14 from before this change): - .js 21414 bytes - .js.gz 5745 bytes new decoder: - .js 24850 bytes (+16%) - .js.gz 6442 bytes (+12%) - 3-4% faster decoding in Chrome - support for Web Workers (which is where most of the size impact comes from!) new decoder with worker support stripped (not part of this PR!): - .js 22715 bytes (+6%) - .js.gz 5831 bytes (+1%) - 3-4% faster decoding in Chrome I'm currently expecting that the extra ~700 bytes of download cost is Not A Big Deal, and that size-conscious applications use webpack which may or may not be able to strip Web Worker support out if that is not used...
This brings up meshopt_decoder modules to the latest versions, which
mostly constitutes a few internal Wasm changes that get reflected in the
different Wasm blobs, and support for Web Workers.
Note that with this change, GLTFLoader will start using decodeGltfBufferAsync
path (see #24460) but by default that still uses the same flow (so no change!).
However, this allows the application to call
... to activate asynchronous geometry decoding. It's expected that the
better default is to not use WebWorkers, but using them can be
beneficial for very large files or very latency-sensitive applications.
Some size/perf stats:
old decoder (0.14 from before this change):
new decoder:
new decoder with worker support stripped (not part of this PR!):
I'm currently expecting that the extra ~700 bytes of download cost is
Not A Big Deal, and that size-conscious applications use webpack which
may or may not be able to strip Web Worker support out if that is not
used (that said I haven't tried).