Загрузка видео...

Не удалось загрузить видео

На главную

Ported Google's Draco decoder to pure JavaScript. 4.3× smaller than the WASM build, byte-for-byte identical output, often faster once you factor in load, init and parse.

95,436 просмотров • 3 месяцев назад •via X (Twitter)

Комментарии: 49

Фото профиля mrdoob
mrdoob3 месяцев назад

This library shines on spotty mobile connections, where transferring 100KB takes much longer than 20KB. Even if JS parsing is slower than WASM, the model displays faster because of the reduction in network overhead.

Фото профиля mrdoob
mrdoob3 месяцев назад

Managed to reduce the bundle size. It's 5.2× smaller now.

Фото профиля Volodymyr Agafonkin 🇺🇦
Volodymyr Agafonkin 🇺🇦3 месяцев назад

Very cool! A well-optimized JS version of a code like this can match native performance in my experience too. You should try meshopt decoder next! At Mapbox, we have switched from Draco to Meshopt because it's both simpler, faster and generated smaller models for our use case.

Фото профиля mrdoob
mrdoob3 месяцев назад

Oh! I'll put that on the list 🤓

Фото профиля Arseny Kapoulkine
Arseny Kapoulkine3 месяцев назад

@mourner Pure JS version is maintained here ;) (it's not particularly optimized, I'm sure it can be faster - getting close to Wasm speed should be impossible however, and the Wasm decoder bundled into JS is pretty tiny, but just in case you need JS-only option)

Фото профиля Volodymyr Agafonkin 🇺🇦
Volodymyr Agafonkin 🇺🇦3 месяцев назад

@mrdoob Happy to see you chime in, amazing project! I guess you mean it’s impossible because of the SIMD build? But for certain cases (e.g a ton of smallish models), JS to WASM comms overhead could be bigger than the SIMD win. Worth an optimization pass attempt at least 😊

Фото профиля Arseny Kapoulkine
Arseny Kapoulkine3 месяцев назад

I would be quite skeptical; the communication overhead is really just a copy of data in & out of the Wasm heap - it's not free but it's comparatively cheap and it's easy to lose much more on inefficient codegen. It's also not just SIMD; even scalar Wasm often runs faster than optimized JS for these workloads. But of course people should experiment :)

Фото профиля Volodymyr Agafonkin 🇺🇦
Volodymyr Agafonkin 🇺🇦3 месяцев назад

@mrdoob Challenge accepted, I'm really curious! Will do some benchmarking on our typical workloads and report back

Фото профиля Volodymyr Agafonkin 🇺🇦
Volodymyr Agafonkin 🇺🇦3 месяцев назад

@mrdoob You were right! On a typical Mapbox workload (90 buffers, 16.5MB compressed total), baseline JS reference is 14x slower than WASM; after heavy optimization, it's still 3.5x slower. The WASM version is exceptionaly fast and small, and cold start is 4-5ms (negligible)

Фото профиля herbst
herbst3 месяцев назад

@fernandojsg Now do KTX2! 😄

Фото профиля mrdoob
mrdoob3 месяцев назад

@fernandojsg Tempting 😅

Фото профиля robot 2.0
robot 2.03 месяцев назад

you are really ramping up the speed lately

Фото профиля mrdoob
mrdoob3 месяцев назад

I actually did this back in January with poor Opus 4.5. Decided to do another pass with 4.8 and finish it off today.

Фото профиля Alex Spînu
Alex Spînu3 месяцев назад

This is cool - would be cool to see Cesium's gltf-pipeline for draco for batch compressing built in ( if the scope isnt to have a 1:1 draco port ) :D

Фото профиля mrdoob
mrdoob3 месяцев назад

Feel free to send a PR or do whatever it's needed 🤗

Фото профиля gsimone
gsimone3 месяцев назад

This feels like a good idea for a lot of cases, make sure to ship a benchmark - cli so agents can do it - so people can use to find the best tool for their job - eg. there's got to be a breaking point where paying the extra is worth it

Фото профиля David Ronai
David Ronai3 месяцев назад

omg thats big ! 🥳

Фото профиля Anderson Mancini
Anderson Mancini3 месяцев назад

Thats huge 🤯🤯🤯👏🏻👏🏻👏🏻

Фото профиля Nicola
Nicola3 месяцев назад

Would you recommend to use it already? I use Draco for boats models.

Фото профиля mrdoob
mrdoob3 месяцев назад

Feel free to give it a go ✌️

Фото профиля Aymeric Rabot
Aymeric Rabot3 месяцев назад

@wawasensei Yay! Thx

Фото профиля Gregor
Gregor3 месяцев назад

wasm init was costing me 380ms before a single byte parsed

Фото профиля Luke Wood
Luke Wood3 месяцев назад

This further supports my opinion that WASM is just generally not very useful.

Фото профиля tim
tim3 месяцев назад

@threejs wow

Фото профиля David Bang 💥
David Bang 💥3 месяцев назад

u r awesome

Фото профиля AiDevCraft
AiDevCraft3 месяцев назад

The "once you factor in load and init" line is the unsung headline — for one-shot mesh decodes the WASM startup tax often eats its steady-state win. Bonus is sidestepping the SharedArrayBuffer/COOP header dance the WASM build usually drags into a CDN.

Фото профиля Dishant
Dishant3 месяцев назад

the init time difference is wild. that alone makes it worth it for web use

Фото профиля Andrea Giammarchi 🍥
Andrea Giammarchi 🍥3 месяцев назад

Some crash on Safari Mobile + littlest Tokyo has no light but overall wonderful project/port

Фото профиля keaukraine
keaukraine3 месяцев назад

On my Pixel10 at battery saving power mode total improvement is ~1.1x on average. Load+init times are way longer for WASM, up to 400 ms which is user-perceivable. JS parse times are also not that bad. Overall, I agree that JS version is good enough.

Фото профиля Jules ⭐
Jules ⭐3 месяцев назад

JS is fast 💪

Фото профиля just-a-programmer
just-a-programmer3 месяцев назад

Why is the wasm larger?

Фото профиля OGD
OGD3 месяцев назад

@threejs Sick!

Фото профиля Alvaro アルバロ
Alvaro アルバロ3 месяцев назад

@threejs 🙌

Фото профиля Skal
Skal3 месяцев назад

Oh wow, nice! You know who to ping :)

Фото профиля mrdoob
mrdoob3 месяцев назад

Haha yes. The man is very busy these days though 😅

Фото профиля Daniel Cluff
Daniel Cluff3 месяцев назад

@iced_coffee_dev This is pretty cool but it looks like parsing is often slower. This is fine for one off imports but if you are loading a large amount of assets wasm probably wins. I would like to see a benchmark that tests performance at scale.

Фото профиля mrdoob
mrdoob3 месяцев назад

@iced_coffee_dev Yeah. Do it 👌

Фото профиля Benny Schuetz
Benny Schuetz3 месяцев назад

That's pretty slick!

Фото профиля Carmelo schepis
Carmelo schepis3 месяцев назад

Impressive savings and speed boost!

Фото профиля hyeseong.kim
hyeseong.kim3 месяцев назад

Pure JS port for the real win!

Фото профиля 🌵 Marcel Wiessler
🌵 Marcel Wiessler3 месяцев назад

But... in the video WASM rendering shows up before JS - what am I missing?

Фото профиля Erik Sombroek
Erik Sombroek3 месяцев назад

Thats really nice!

Фото профиля Palash Bansal
Palash Bansal3 месяцев назад

This is awesome, will put it in the 3d model quicklook app

Фото профиля Guilherme O'Tina
Guilherme O'Tina3 месяцев назад

this is a great counterexample to the assumption that wasm is always the right call for web delivery. for long-running compute wasm wins easily. but for draco decoding where each call is short and the init overhead dominates, pure JS can win on total time plus bundle. 4.3x smaller changes the economics for shipping 3d on the web

Фото профиля Jens Fursund
Jens Fursund3 месяцев назад

This is awesome!

Фото профиля Afshawn Lotfi
Afshawn Lotfi3 месяцев назад

used to use Draco, like meshoptimizer better

Фото профиля tandavas
tandavas3 месяцев назад

@iced_coffee_dev Extremely cool!

Фото профиля Saad Haider
Saad Haider3 месяцев назад

Parse time is always bigger so for a game with alot of models, .js wont matter as the total parse time would make it par with the .wasm

Фото профиля mrdoob
mrdoob3 месяцев назад

Yes

Похожие видео