I really wanted to know which libraries are bloating my WebAssembly binaries, so I wrote a visualizer.
Throw in a .wasm file with DWARF debug symbols, and wasmphobia will generate a flame graph for you, breaking down the module by source file.
*sigh* okay:
Frontend dev: hard.
Backend dev: hard.
Language design: hard.
Writing docs: hard.
HTML/CSS: hard.
UI design: hard.
Communicating: hard.
Leading people: hard.
Management: hard.
It's all hard. Each one of these is an endless rabbit hole. And it's not a competition.
Happy accident: Had my ultra-wide monitor in split-screen mode and plugged in the same laptop via USB-C and HDMI.
This might be my favorite set up yet.
I wish I had known about this a couple years ago: A really detailed, interactive diagram of WebGL’s internal, global state object, where you can see how each WebGL API call affects said object.
New year. New city. New job.
After almost 7 years, I left the Web DevRel team at Google today. It was an incredibly tough decision, but I think it was the right decision for me. I’ll miss working with this incredible group of people on a daily basis.
TIL:
`document.getElementsByClassName()` & Co return _live_ `NodeList`s.
`document.querySelectorAll()` returns a _static_ `NodeList`.
Use `querySelectorAll()`, people!
🎉 As of today,
@ShopifyEng
is officially a member of Ecma and I will be one of the delegates for TC39.
Feeling pretty chuffed I get to continue pushing JavaScript forward.
British politeness vs German directness is one of my favorite dynamics at home:
Her: “I’d love a smoothie if you are making one”
Me: “I’m not making one”
Her: *stunned and a slightly angry look*
Her: “... I’d love a smoothie. Would you make me one?”
🇩🇪 vs 🇬🇧
A City in a Bottle 🌆
<canvas style=width:99% id=c onclick=setInterval('for(c.width=w=99,++t,i=6e3;i--;c.getContext`2d`.fillRect(i%w,i/w|0,1-d*Z/w+s,1))for(a=i%w/50-1,s=b=1-i/4e3,X=t,Y=Z=d=1;++Z<w&(Y<6-(32<Z&27<X%w&&X/9^Z/8)*8%46||d|(s=(X&Y&Z)%3/Z,a=b=1,d=Z/w));Y-=b)X+=a',t=9)>
Chrome Canary just got structuredClone()! That means *all* browsers (yes, even Safari) and Deno now support structuredClone() in their nightlies (some even shipped it to stable already!)
Massive shoutout to
@AndreuBotella
(not a Chromie!) for implementing structuredClone() <3
Here’s some official guidance for web developers by
@ChromiumDev
what to do regarding Spectre/Meltdown:
TL;DR:
- Set correct(!) `Content-Type` headers
- Set `X-Content-Type-Options: nosniff`
- If possible, use SameSite cookies
Do you like `useReducer`? Then you might like `useWorkerizedReducer` which runs the reducer in a worker. This allows you to place long-running, blocking logic inside a reducer.
➡️ React & Preact
➡️ 5KiB brotli’d
➡️ postMessages patches, not entire state
I guess I shouldn’t be surprised, but as a manager of 3 women in tech that produce YouTube content, I am getting a first hand experience with the amount vile shit they got thrown at them in the comments every day.
Makes me wanna punch these men in the face.
(╯°□°)╯︵ ┻━┻
Me two weeks ago:
“Oh I know, I’ll quickly add an API endpoint that accepts tar files. That’s a simple file format.”
Me now, using reverse engineering tooling to debug why the off-the-shelf tar library truncates file names:
“What the fuck.”
I used WebGPU to spawn 256 × 65536^2 = ~1.1 trillion threads on my GPU, and it visually froze my entire MBA for about 4 seconds.
I am not sure why I even tried spawning 256 × 65536^3 = ~72 quadrillion threads, but my screen is just black now. According to math, for 72+ hours.
Today I champion’d my first JavaScript proposal at TC39 and it’s now stage 1! 🎉
“JS Module Blocks” aka. “Surma *really* wants you to use workers”
(Thanks
@gesa
,
@littledan
and
@_shu
for all the help!)
📢 Blog: WebGPU — All of the cores, none of the canvas!
I got my feet wet with WebGPU, a low-level API for GPUs, and did some massively parallel computations.
⚠️ This is a long one, but I think it’s the right way to intro WebGPU!
Read it here 👇
Proud to finally show off to the world.
@argyleink
@_developit
@jaffathecake
@kosamari
@Una
& myself have been working on it, together with the teams of Parcel, Rollup and webpack to give a comprehensive overview of what bundlers are capable of.
📝New blog post 🎉
Is WebAssembly magic performance pixie dust✨? Can you replace JavaScript with Wasm and things get faster?
➡️ JS to AssemblyScript
➡️ Benchmarking & Profiling
➡️ Debugging the runtime
➡️ Comparing file size
➡️ also feat Rust & C++
👇
I have been working on a CSS Container Query polyfill for all major browers.
It aims to cover the majority of CQ use-cases rather than 100% spec compat, which is why it’s only 1.6K brotli’d.
Please look at the README, play with it and help me test it!
It's the only thing I ever spec'd, landed, got implemented and shipped to stable by all browsers.
It's really cool (and weird) seeing others pick it up, even though I realize that's just another tuesday for most of the specs folks.
In what year can I safely tweet about a CSS or JS feature without having at least one reply guy tell me that IE11 doesn’t support said feature?
Believe me, mate. I know.
📣 New year, new blog post: I fell into the rabbit hole that is monochrome image dithering. I wrote down everything I learned! 👨🎓
(… and wrote a small demo that dithers an image with all these different dithering algorithms.)
👇
I’ll take a bit of a break in January. Then I’ll start my new role as a software engineer at
@ShopifyDevs
, where I’ll work on the developer experience of their platform. I am super happy to continue working with and on web technologies and hope I can shape things for the better.
📣 New blog post: When should you be using web workers? (Spoiler alert: Always!)
➡️ What are web workers?
➡️ Mobile phones and The Widening Performance Gap™️
➡️ App architecture on native platforms
➡️ The role of web frameworks
👇
We gave Squoosh a major overhaul!
Proud to share ✨Squoosh v2✨
— built by
@argyleink
@_developit
@jaffathecake
and
@RReverser
. Super proud of the team.
➡️ Next-gen image codecs
➡️ Wasm threads & SIMD
➡️ Design overhaul
➡️ A CLI for batch processing
Many people have said this, but it’s always such a pleasure, so I’ll say it again:
Generators are _so_ handy for stuff like AST walkers or similar traversing algorithms.
To distract myself from the Weltschmerz, I fixed a bug in Shopify's Rails implementation of OAuth. Took 2 workdays from start to shipped in prod.
Coming from Google, I am astonished that a company newbie with no Rails background was allowed (& encouraged!) to patch auth and ship
Top productivity tip:
Use the split screen of your monitor so you can see both your switch and your work at the same time. It will make you much more efficient at ignoring work.
This table says it all. One of the reasons we're going big on Rust it because it delivers incredible economies, without trading off safety. On Cloud, sustainability is a big motivator, and on devices battery lifetime is the biggest differentiator.
Measuring file/bundle size changes in percent is not helpful (+20% can be +2B or +2MB). Measuring file size change in bytes is not very intuitive to me.
I started thinking about file size changes in _seconds_, using “Slow 3G” (376kbit/s) as a baseline, and I kinda like it 🤔
📝New
#WebAssembly
blog post (on my new blog😱)
Compiling C to WebAssembly *without* Emscripten!
➡️ Using vanilla LLVM
➡️ Analyzing build artifacts
➡️ Consequences of not having a libc
➡️ Building your own malloc()
📣Announcing: Comlink v4 alpha!
Use workers without thinking about workers.
Rewritten from scratch!
➡️A lot smaller (~1.1kb) 🗜
➡️Considerably faster 🏎
➡️(Hopefully) easier to use ✨
➡️Simpler code 🍝
➡️Breaking changes 🧨
Please give it a try and file issues and feedback.
My new research pattern for buying stuff seems to be:
1️⃣ Google for product(s)
2️⃣ Wait a day
3️⃣ Look at Instagram to see ads for better, competing products
📝Blog post: React + Redux + Comlink = Off-main-thread
I took a stab at moving Redux to a worker using Comlink. Reduces parsing and execution costs on your UI thread and keeps it responsive for UI work.
🎉 Module Blocks just advanced to Stage 2 in TC39 🎉
- Proposal:
- Spec:
- Greenlet-like library using module blocks (obv. not runnable anywhere right now):
Today I champion’d my first JavaScript proposal at TC39 and it’s now stage 1! 🎉
“JS Module Blocks” aka. “Surma *really* wants you to use workers”
(Thanks
@gesa
,
@littledan
and
@_shu
for all the help!)
Wait, is this news to anyone? Am I just late to the party? Am I missing something?
With this 15 line `h` function, you can use JSX for DOM ops w/ all the good stuff:
- Inline event handlers
- Custom elements
- Props and attributes (which React still can’t do, lol)
I dig it 🤨
At
@ShopifyEng
,
@saulecabrera
, Jeff Charles and I are working on Javy, a tool to compile JS to WebAssembly. We are using it to bring JS to Shopify Functions, but kept Javy itself as a generic JS-to-Wasm tool!
Curious how it works? Here’s a tech deep-dive:
I see web development gatekeeping Twitter is alive and kicking, so let me say this:
If it renders right, is performant and accessible, you are doing fine.
This was a hack for work but is now used by me almost daily: A bookmarklet that speeds up the video on the current page by 25% with each click.
Useful when there are no speed controls, or — like YouTube — limit it to 2x, but I wanna go fasterrrrrr.
📣New WebAssembly article:
How we replaced a JavaScript hot path in with WebAssembly to get predictable performance across all browsers.
Featuring:
➡️ C & Emscripten
➡️ AssemblyScript
➡️ Rust
Article here 👉
I lost access to a .eu domain i have because I used my UK address for the contact information. Apparently, since Jan 1st, UK citizens are not eligible for .eu domains anymore because
#brexit
.
🤦♂️🤦♂️🤦♂️🤦♂️🤦♂️
`structuredClone()` is on its way to stable in all major browsers, and already available in Firefox, Node 17 and Deno.
I thought it was time to write an article!
👀👇
🔊 HERE IT IS!
Off The Main Thread — A new developer podcast with
@jaffathecake
and myself.
In this first episode I talk about WebGPU and Jake talks about if browsers are like political parties 🔥
Find it wherever you find your podcasts or go here:
🆕 Blog post 📣
I wanted to run JavaScript in WebAssembly, so I decided to turn JavaScript into a compiled language by building a JS-to-C++ transpiler.
How does it work? And is it a good idea? Well, that’s what the blog post is about!
👀👇
📽 I think many people are disappointed that the uploaded version of my
#ChromeDevSummit
talk doesn’t show what actually happened. If you want to watch me have technical difficulties, I uploaded “State of Houdini — Director’s Cut (aka. Honest Edition)” 🙈
Small trick
@_developit
taught me:
How to make CSS loading non-blocking the quick’n’dirty way.
(Thanks
@cramforce
and
@mathias
for corrections/improvements :D)
It’s kinda fascinating to think that Linus started Git on April 3, 2005; announced it on April 6 and switched Linux over from BitKeeper to Git on April 18. GitHub was then founded in early 2008 and now the mercurial vs git debates or CVS on SourceForge seem like a ridiculous past
Today in "nope": An article featuring gems like
"C is a mid-level programming language"
"C developers are known to craft comparatively organized, clean code"
"The most popular Python implementation is in C. […] C knowledge would come in handy when deciphering Python code."
📣New blog: “Layers and how to force them.”
Whenever you animate stuff on the web, I say “put it on its own layer! ☝️ ”, but
what are these layers? What is `will-change` and why don’t I like it?
More here:
Mini-hack of the day:
Removed the Google Analytics script from my blog in favor of sendBeacon()-based custom code by
@philwalton
(thank you!).
It’s smaller, it’s anonymous (I don’t track users anymore) and I can collect core web vital scores.
📝 Friday blog post: I tried to write up my mental model of how to develop for developers.
It’s easy to over-do it with abstractions. Escape hatches, layering abstractions and reusing the idioms of the platform gives developers agency.
👀👇
Not gonna lie,
@github
’s auto-complete is *still* constant source of frustration in my daily work (cc
@natfriedman
).
Prioritize pariticipants of the current issue/PR, then contributors, then members of the org.
Don’t do... whatever it is doing right now.
I sneakily released Comlink v4 just before
#io19
!
➡️Smaller than v3 (~1.1kb) 🗜
➡️10x faster on low-end devices (we needed that for !) 🏎💨
➡️Better API naming 💫
➡️Better folder structure 🙏
➡️Support for workers in Node 11+ 🤯
Fun tip of the day: Most syntax highlighters as well as prettier understand other web languages as template tags. You don’t need to install any packages, simply alias `String.raw`, the default (implicit) tag!
Both files were identical and then processed by prettier.