Jake Bailey
@jakebailey.dev
3.9K followers 360 following 1.3K posts
According to git blame, I wrote the TypeScript compiler, don't fact check that Principal Software Engineer at Microsoft working on TypeScript Underground gopher, finally revealed https://jakebailey.dev/ https://github.com/jakebailey arch btw
Posts Media Videos Starter Packs
jakebailey.dev
Was the candidate Joe Tsai
jakebailey.dev
Have you ever seen anyone with one of the t-shirts? Are we sure they even existed
jakebailey.dev
Not to mention anyone downloading random users' APKs from GitHub releases, or anyone using App Cloner, or anyone making an app Google doesn't like (like adblockers)
jakebailey.dev
like the previous game they just have to keep doing the thing where they put a boss in an auto locking room so that if you die during it you're forced to replay it over and over and over until you have a raging headache
jakebailey.dev
and yet I can't stop opening the game
jakebailey.dev
SILKSONG ENEMIES SHOULD NOT DO TWO MASKS OF DAMAGE AAAAAAAAAAAAA
jakebailey.dev
You know she's serious because she brings her own gloves
jakebailey.dev
Believe me top of my list is to go see Les Mis
jakebailey.dev
who lives who dies who tells your story
jakebailey.dev
please I keep listening and the situation only get worse
Reposted by Jake Bailey
jakebailey.dev
sqlc, sqlboiler, ent, are where it's at
jakebailey.dev
It is not, no. I have to do a lot of nasty rebasing and I have a bunch of failed ideas I prefer not to show 😅
jakebailey.dev
Forgive the yellow text, even though I killed my color correction app for some reason it still happened to the video out 🫠
jakebailey.dev
I'll note that I found this while working on another optimization, specifically trying to make this DCE the impossible cases:

func foo[T []byte | string](v T) {
switch any(v).(type) {
case string:
// ...
case []byte:
// ...
}
}

Which I do have working on a branch!
jakebailey.dev
No idea but you can see the livestream recording here: www.youtube.com/live/C_ePbVZ...
jakebailey.dev
At least for typescript-go, I'm hoping this helps a lot in generic functions we have that really just pass info around, but are too large to inline. But, it's probably immeasurable.

But, it is fun.
jakebailey.dev
But, the dict is never nil!

My CL (go.dev/cl/706655) detects nil checks of the dict arg and removes them.

It's hard to measure how much this helps; many generic funcs get inlined or need the dict, but I am hoping that this opt means faster code and less wasting of cache lines on unused dicts.
Gerrit Code Review
go.dev
jakebailey.dev
For example, the code for cmp.Compare[go.shape.int] might look like:

00006 TESTB AX, (AX)
00007 CMPQ CX, BX
00008 JGT 14
00009 JGE 12
00010 MOVL $1, AX
00011 RET
00012 XORL AX, AX
00013 RET
00014 MOVQ $-1, AX
00015 RET

The first instruction loads from the dict to do a nil check (e.g. segfault)
jakebailey.dev
The dict arg contains information about the actual types passed into the implementation, used for reflection, type switches, etc.

The compiler generates lookups into the dict arg as though it was a slice of uintptr, and so those lookups actually get a nil check!