Surma Profile Banner
Surma Profile
Surma

@DasSurma

39,823
Followers
1,561
Following
1,953
Media
22,593
Statuses

DX at @ShopifyEng . Web Platform Advocate. Craving simplicity, finding it nowhere. Internetrovert 🏳️‍🌈 He/him. @surma @mastodon .social

Bristol, UK
Joined June 2008
Don't wanna be here? Send us removal request.
Pinned Tweet
@DasSurma
Surma
2 months
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.
Tweet media one
Tweet media two
14
103
599
@DasSurma
Surma
6 years
*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.
228
4K
13K
@DasSurma
Surma
5 years
Incrementing variables in for-loops i++ - overused - nonsensical - imbalanced i-=-1 - hipster - expressive - symmetric
162
2K
11K
@DasSurma
Surma
7 years
My password generator just spat out a password that starts with <H1> and ends with </H1> and now I’m seriously questioning the RNG...
Tweet media one
112
991
3K
@DasSurma
Surma
2 years
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.
64
92
2K
@DasSurma
Surma
2 years
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.
Tweet media one
12
318
2K
@DasSurma
Surma
6 years
Mini function of the day: `nextEvent()`. Gives you a promise for the next event of a certain type. Really nice in conjunction with async/await.
Tweet media one
Tweet media two
Tweet media three
24
357
2K
@DasSurma
Surma
2 years
It’s been 0 days since a new build system for JS came out.
17
108
1K
@DasSurma
Surma
7 years
TIL: If you hover a request while holding shift in Chrome DevTools, the initiator while be green, and all child requests will be red.
Tweet media one
11
684
1K
@DasSurma
Surma
3 years
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.
120
13
1K
@DasSurma
Surma
6 years
TIL: `document.getElementsByClassName()` & Co return _live_ `NodeList`s. `document.querySelectorAll()` returns a _static_ `NodeList`. Use `querySelectorAll()`, people!
Tweet media one
30
445
1K
@DasSurma
Surma
6 years
Looking for a Senior React Hooks engineer with at least 4 years experience. DMs are open.
29
180
1K
@DasSurma
Surma
2 years
🎉 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.
35
48
1K
@DasSurma
Surma
7 years
This is your reminder to enable Brotli on your servers. It beats gzip in compression ratio and decompression speed.
Tweet media one
29
481
1K
@DasSurma
Surma
3 years
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 🇬🇧
38
35
1K
@DasSurma
Surma
2 years
Generated by an HTML file that's 256 bytes small. Wtf.
@KilledByAPixel
Frank Force 🌻
2 years
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)>
65
2K
8K
14
124
983
@DasSurma
Surma
5 years
Who needs top-level await when you can just export a function called `then` from your JavaScript modules?
Tweet media one
Tweet media two
Tweet media three
31
244
967
@DasSurma
Surma
3 years
I am *particularly* annoyed by JavaScript today
Tweet media one
77
75
869
@DasSurma
Surma
3 years
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
Tweet media one
26
185
846
@DasSurma
Surma
7 years
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
4
470
832
@DasSurma
Surma
4 years
If you need a good thrill during lockdown: Git Russian Roulette — A git alias that has a 1 in 8 chance of throwing away all your uncommitted code.
Tweet media one
19
250
841
@DasSurma
Surma
7 years
Dear websites: Just because I’m in France does NOT mean I want your website in French. Please read the `Accept-Language` HTTP request header
Tweet media one
23
334
823
@DasSurma
Surma
6 years
It’s been shared before (sometimes with a wrong URL), but it’s official now: Google Maps has launched a proper PWA 🎉 Go here:
Tweet media one
22
362
825
@DasSurma
Surma
3 years
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
Tweet media one
Tweet media two
15
117
835
@DasSurma
Surma
7 years
📣 Using CSS’ matrix3d() to build a frame-perfect custom scrollbar 🔥 This is the longest I have worked an article.
17
254
819
@DasSurma
Surma
3 years
Ever frustrated by the fact that ✅ only has a green counter part (❎) but not a red one? CSS `filter: hue-rotate(-120deg)` can help!
Tweet media one
Tweet media two
22
90
796
@DasSurma
Surma
4 years
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. (╯°□°)╯︵ ┻━┻
17
25
797
@DasSurma
Surma
7 months
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.”
Tweet media one
16
26
767
@DasSurma
Surma
2 years
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.
Tweet media one
38
36
740
@DasSurma
Surma
4 years
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!)
Tweet media one
Tweet media two
43
86
738
@DasSurma
Surma
3 years
I got my new Keychron K3, and I’m not gonna lie, writing tweets like this is pretty damn fun.
46
13
732
@DasSurma
Surma
2 years
📢 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 👇
16
143
718
@DasSurma
Surma
4 years
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.
Tweet media one
Tweet media two
18
200
706
@DasSurma
Surma
3 years
📝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++ 👇
27
180
699
@DasSurma
Surma
3 years
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!
13
158
697
@DasSurma
Surma
5 years
Maybe we should write all documentation in German and everyone should just learn German. Most libraries could be explained in a single word.
27
57
681
@DasSurma
Surma
2 years
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.
@builderio
Builder.io
2 years
There’s a native API for deep copying objects in JS: structuredClone No more JSON.stringify hacks, no need for lodash or other libs. Magic.
Tweet media one
33
566
3K
14
80
672
@DasSurma
Surma
4 years
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.
45
42
667
@DasSurma
Surma
6 years
I, in fact, did NOT mean that.
Tweet media one
24
69
662
@DasSurma
Surma
4 years
📣 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.) 👇
42
151
651
@DasSurma
Surma
2 years
“Be the change you want to see in the world” I will now switch all my personal JS projects to using tabs for indentation.
Tweet media one
52
41
622
@DasSurma
Surma
3 years
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.
73
7
631
@DasSurma
Surma
5 years
📣 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 👇
26
194
621
@DasSurma
Surma
4 years
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
Tweet media one
Tweet media two
29
146
612
@DasSurma
Surma
5 years
TIL: `gray` is darker than `darkgray`. Go home, CSS. You’re drunk.
Tweet media one
20
98
606
@DasSurma
Surma
2 years
Not the point of this thread but: 👏 Engineers shouldn’t have to become managers to advance their career 👏
19
55
607
@DasSurma
Surma
7 years
Houdini’s CSS Paint API (also known as “Custom Paint Worklet”) is going to be enabled by default in Chrome 65! I wrote an introduction for ya:
14
262
608
@DasSurma
Surma
3 years
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.
Tweet media one
22
53
605
@DasSurma
Surma
6 years
Pro Tip: Don't auto-translate names of people you send letters to. ("Surma" means "death" in Finnish 🇫🇮)
Tweet media one
16
70
601
@DasSurma
Surma
4 years
Today I committed my first line of code to Chromium 🎉 It’s literally a one-liner, but it is a very exciting feeling nonetheless.
Tweet media one
18
10
598
@DasSurma
Surma
5 years
Cab driver: "Have a good flight!" Me: "You too!" 🤦‍♂🤦‍♂🤦‍♂
28
16
591
@DasSurma
Surma
5 years
Alright, Internet. I'm doing it. Ditching MacOS, switching to Windows / Linux dual-boot. Not sure yet where I'll spend most of my time.
Tweet media one
97
15
586
@DasSurma
Surma
2 years
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
27
20
578
@DasSurma
Surma
6 years
📝New blog post: “Senior engineers will HATE me for revealing this ONE RegExp trick 👌” (That was the working draft title, at least.)
23
140
572
@DasSurma
Surma
1 year
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.
Tweet media one
14
41
554
@DasSurma
Surma
2 years
The delta between JavaScript and TypeScript makes me question how this was measured.
@colmmacc
Colm MacCárthaigh
2 years
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.
Tweet media one
59
347
2K
45
37
538
@DasSurma
Surma
3 years
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 🤔
Tweet media one
13
59
535
@DasSurma
Surma
4 years
Watch this.
9
127
524
@DasSurma
Surma
8 years
Git ProTip: Adjust your .gitattributes to make `git diff` more useful for images and other binary formats!
Tweet media one
2
289
521
@DasSurma
Surma
7 years
My touchbar crashed. I now have no escape button. I am trapped in vi. Send halp.
24
173
514
@DasSurma
Surma
5 years
📝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()
13
155
498
@DasSurma
Surma
5 years
📣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.
Tweet media one
19
125
492
@DasSurma
Surma
3 years
The crypto/web3 crowd has reached the "guns don't kill people, bullets do" level of arguing.
Tweet media one
14
52
490
@DasSurma
Surma
5 years
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
16
60
481
@DasSurma
Surma
7 years
TIL: Start Chrome with `--app=<url>` to get a chromeless window just for just that site. Great for tiling window managers! h/t @ericlaw
8
156
475
@DasSurma
Surma
2 years
nice
Tweet media one
20
8
479
@DasSurma
Surma
5 years
📝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.
13
129
463
@DasSurma
Surma
3 years
🎉 Module Blocks just advanced to Stage 2 in TC39 🎉 - Proposal: - Spec: - Greenlet-like library using module blocks (obv. not runnable anywhere right now):
@DasSurma
Surma
4 years
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!)
Tweet media one
Tweet media two
43
86
738
14
83
455
@DasSurma
Surma
7 years
TIL: document.designMode = 'on'; h/t @AmeliasBrain
9
218
441
@DasSurma
Surma
4 years
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 🤨
Tweet media one
15
55
437
@DasSurma
Surma
6 years
For the Mac users who want Twitter in it’s own little window: open -na 'Google Chrome' --args '--app='
@Support
Support
6 years
For the full Twitter experience on Mac, visit Twitter on web. 👉
183
201
415
12
97
428
@DasSurma
Surma
1 year
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:
Tweet media one
24
62
432
@DasSurma
Surma
2 years
Lol how is this acceptable?!
Tweet media one
58
17
428
@DasSurma
Surma
1 year
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.
16
46
428
@DasSurma
Surma
4 years
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.
Tweet media one
15
49
425
@DasSurma
Surma
4 years
Nervously excited about presenting a JavaScript proposal that I am championing to TC39 tomorrow 😬
20
1
418
@DasSurma
Surma
7 years
📣 Blog: How I rendered DOM to a canvas so I can use CSS layouting and text rendering in WebGL (and WebVR!)
18
124
418
@DasSurma
Surma
6 years
As promised, here’s my write-up on how to use Emscripten to compile a C library to WebAssembly and run it on the web.
Tweet media one
8
146
414
@DasSurma
Surma
5 years
📣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 👉
Tweet media one
11
106
416
@DasSurma
Surma
4 years
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 . 🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️
24
34
416
@DasSurma
Surma
7 years
📝 New post-🎄 blog post about architecture and web apps: The Actor Model and why I think it implies that DOM-in-workers is undesirable.
11
131
413
@DasSurma
Surma
8 months
🔊 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:
28
47
415
@DasSurma
Surma
5 years
now includes hqx, a pixel-art upscaling algorithm. Available in all* browsers! *) except Chrome (Shout-out to @CryZe107 for his hqx Rust library!)
10
77
406
@DasSurma
Surma
2 years
🆕 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! 👀👇
28
69
405
@DasSurma
Surma
6 years
📽 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)” 🙈
26
49
400
@DasSurma
Surma
6 years
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)
Tweet media one
Tweet media two
4
82
401
@DasSurma
Surma
4 years
My new camera setup allows me to deliver performance reviews to my reports in a more... convincing way.
21
5
397
@DasSurma
Surma
2 years
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
11
23
386
@DasSurma
Surma
3 years
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."
Tweet media one
24
34
384
@DasSurma
Surma
6 years
📣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:
8
123
378
@DasSurma
Surma
3 years
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.
Tweet media one
Tweet media two
7
47
376
@DasSurma
Surma
2 years
📝 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. 👀👇
8
75
370
@DasSurma
Surma
4 years
🎉 Today is the day! 🎉 We are going to publish the recorded talks from #wasmsummit . <🧵Thread>
Tweet media one
Tweet media two
9
107
368
@DasSurma
Surma
4 years
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.
Tweet media one
19
15
364
@DasSurma
Surma
3 years
Lol fuck off, professionals google basic shit too; Not just students.
Tweet media one
17
22
363
@DasSurma
Surma
5 years
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+ 🤯
Tweet media one
5
73
367
@DasSurma
Surma
6 years
Running the same test suite in different browsers. A metaphor in five acts.
1
132
361
@DasSurma
Surma
11 months
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.
Tweet media one
13
36
362