Saurabh Sharma
1.5K posts


Introducing performance.dev!
A new space where I explore how the best apps in the world are built.
First piece:
How's Linear is so fast? a technical breakdown.
performance.dev/how-is-linear-…
English

@arpit_bhayani Yeah i have seen sqlite clone videos with 10k views
English

a Python list isn't a list. it's an array of pointers. calling it a "list" is the most misleading name in programming.
it's not cache-friendly and also it's not compact. it's an array of addresses scattered across RAM.
numpy fixes this by doing what C does: storing the actual values contiguously.

English

@sean_j_roberts For crud apps, go is just as overkill as rust. For networking related stuff making load balancers, CDNs it makes a lot of sense
English

hot take: Go would be the greatest programming language on earth if it had enums and union types. they simplified their way into having to do really weird stuff just to represent reality.
you should still probably use it though.
flowstate@k_flowstate
banger articles you should read
English

@SumitM_X who uses MR? and what platform are they using certainly not github[.]com
English

@ashoKumar89 for the same reason people are writing python instead of c
English

@curiousharish Aws is confusing? We are really becoming dumber through AI.
English

So I accidentally initialised array in java as
`int n[] `instead of `int[] n` & it compiled which made me curious.
What I found was cool (for me):
- java allowed `int n[]` for C/C++ devs to be at home
- the parser rewrites both into the same AST node
- arrays in Java are first-class types(int[] is a real type)
- both compile to the same bytecode (newarray int)
- the type descriptor at JVM level is [I for both
- the JVM only sees the normalised type
Mixing styles is where it gets ugly:
int[] a, b[]; gives a: int[] & b: int[][]
So Official Java Docs recommend writing [] to make the syntax uniform.
So yeah, no runtime magic here.
This is purely a compile-time normalisation decision. Pretty cool tbh.

English

@arpit_bhayani I worked on exactly the same thing a while back, happy to chat if my experience can be helpful to what you're trying to achieve.
English

Now that I am working on full-fledged AI systems at Razorpay and building them from the ground up, two things are pretty clear...
1. The workflow of AI systems is genuinely different.
You have to think AI first from the start - how execution flows, how skills are composed and invoked, sub-agent orchestration, active and passive evals, etc. The only way to develop that intuition is to build a lot of prototypes and know SDKs and patterns inside out. Reading about it does not get you there.
2. System design and low-level design are more crucial than ever.
The harness around these systems demands serious system design, no exaggeration here. Features like pause and resume workflows, serving, checkpoints, pipelines, sync async invocations, observability, cost tracking, versioning, rate limiting, quota management - just to make your long-running executions work without hiccups at any scale is a super interesting challenge.
Apart from this, the importance of low-level design is very high because of extensibility, and over-abstraction - that we all joke about - is actually super critical. Think of external systems that you connect to for your workflows, downstream systems that need to interface and fall back from one system to another, etc.
To be honest, I am not as AI-pilled as some of the other folks in the org, but I am getting there :) And it has been an insane learning curve. But yes, building production AI applications is so much fun.
There is a lot to learn. That part never changes.
English

@iavins I refuse to believe that google doesn't use a hashmap of the remaining usernames to do O(1) checks and O(1) deletions when a username is taken
English

The correct answer that works at Google scale is a regex db.
- Incremental building: O(1)
- Lookup: O(m) where m is the length of the username, (so it's like constant)
The size would be negligible because it doesn't have to store all the characters, well, it's a regex
Tanuj@tanujDE3180
Interviewer: You type a Gmail username and UI instantly shows "Username already taken" There are millions of users globally How does it check so fast?
English

@iavins That’s really interesting.
Btw I learned about Gossip Glomers from you the other day, and I’ve started working through the exercises. It’s challenging but enjoyable.
English

lowkey tempted to do the same in my vacuum code so that some day some angry user wakes up glauber and/or pekka at 3am
v@iavins
Here is an insane piece of lore inside SQLite's source code I am researching VACUUM and I was studying their code. In VACUUM, SQLite creates a temp file prefixed with `etilqs_` Here is why:
English

We use asserts all the time in Turso DB and also in the Turso Server. They're in release builds and shipped to production. And yes, they could crash the server.
Asserts are my favorites, and I use them whenever possible. Just yesterday I merged a PR that contained asserts and nothing more. So when do you use them? Use asserts for checking invariants. If that invariant has failed, then something must have gone horribly wrong; I'd prefer to crash the server than continue.
Like this made-up example:
let a = 5;
let b = 7;
assert!(a < b, "likely the world has ended");
Asserts help quickly catch logical bugs and prevent something catastrophic. In a database, if some invariant isn't holding up, it could lead to corruption, data loss, or failure of ACID guarantees. Crashing is preferred over proceeding. However, it's incorrect to use them as error handling.
1. You can assert that a write txn has the exclusive write lock before it writes
2. When you read a page from disk, if the read is successful, you can assert that the page exists in the buffer pool
3. Like in MVCC, you can assert that the row's timestamp is less than the txn's (i.e., a txn cannot read rows from some future txn)
In practice, we have two macros: `assert` and `debug_assert`. We have a friendly wrapper on top of these. `debug_assert` is fatal in debug builds and logs the condition and message as an error in release builds. `assert` is shipped in both - it's fatal on failure.
Rust has a rich type system. Sometimes types help, but most of the time we need asserts. Last year I spent a lot of time writing state machines and used plenty of asserts to check conditions. For example, if the code isn't supposed to be in state X without condition A being true, that's checked with an assert.
Asserts also go well with Deterministic Simulation Testing. DST is the one strong reason that we have asserts all over the place. DST is that magical testing philosophy which lets you reproduce the super hard bugs easily. I keep running the simulator, let the asserts fail and then fix the logical bug.
We don't use asserts for data from user inputs or S3 (we assume S3 could get corrupted), and for tenant-specific cases we raise errors instead since we're multi-tenant.

v@iavins
Arguably, Go doesn't have asserts because, well, Pike doesn't like them 🥲
English

@immasiddx This is why I think everyone should speak english. 90% of that file size is translation files
English

@jai_dewani @anuraghazru Typescript chose go over rust and c# for their port
English

I think speed/performance is the ultimate measure of user experience, and I love that Ghostty focuses on that.
Amazon invests in the things that won't change. No one's going to say, "I wish my order took longer to deliver," or "I wish this app were slower."
Speed is objective and easy to measure. I'd rather look at how long it takes someone to get the outcome they want than debate stylistic preferences.
I was able to install Ghostty and use it out of the box with zero configuration to work on a project. That's fast. And delightful. 🙂
English

Thanks @antirez. I'm going to share this whenever anyone scoffs at me and says "`cat` performance doesn't matter". This stuff matters, it has real productivity implications. I smiled at this because we worked hard on this and I'm glad someone I respect so much noticed.
For what it's worth I gave a lightning talk on some parts of how we do this: youtu.be/cPaGkEesw20?t=… (timestamp link)
Usually the "scoffers" will be snarky and say: you should pipe it to a file or pager. Sometimes yes, but if you don't have to... why? Also, I don't know about you but I've routinely accidentally dumped a ton of text to my terminal unintentionally. With Ghostty it's just a total non-issue.
Love this.

YouTube

English

🔥 5 Tweaks to Boost Conversions!
1️⃣ Interactive GIFs instead of images
2️⃣ ‘Video-in-hover’ for previews
3️⃣ Competitor price comparisons
4️⃣ Add to Wishlist popup
5️⃣ FAQ based on visitor clicks
🌱 Eco impact display
#Shopify
English










