placeholder

Please Restore Our Registers When You’re Done With Them

“Hey, you. Yes you, that function over there. When you’re cleaning up please remember to restore all of my registers. Yes, that one too – what do you think this is, Linux?”That’s the problem I was …

Click to view the original at randomascii.wordpress.com

Hasnain says:

Assembly is so hard to get right. More so in a cross-platform manner.

"I decided to write this up because I thought that the journey was interesting, but also because the journey is not over. There could be other registers that are not being properly saved and restored in Chromium. There could be other projects that are making this mistake, perhaps not aware of the differences between the Linux and Windows ABI. Any software rules that are not tested and enforced are inevitably broken and I am not aware of any consistent testing to detect ABI violations. More bugs of this type seem inevitable."

Posted on 2022-11-29T06:01:04+0000

placeholder

Coping strategies for the serial project hoarder

I gave a talk at DjangoCon US 2022 in San Diego last month about productivity on personal projects, titled “Massively increase your productivity on personal projects with comprehensive documentation and …

Click to view the original at simonwillison.net

Hasnain says:

Bookmarking this for later rereading. some of this is stuff that's worked well for me, and a lot of it was novel stuff. I'm a huge fan of issue driven development and documenting via commits, for what it's worth.

The quote though, uhhhhh....

"This is the most important tip: avoid side projects with user accounts.

If you build something that people can sign into, that’s not a side-project, it’s an unpaid job. It’s a very big responsibility, avoid at all costs!

Almost all of my projects right now are open source things that people can run on their own machines, because that’s about as far away from user accounts as I can get.

I still have a responsibility for shipping security updates and things like that, but at least I’m not holding onto other people’s data for them."

Posted on 2022-11-28T06:09:50+0000

placeholder

Index Merges vs Composite Indexes in Postgres and MySQL

Index Merges vs Composite Indexes in Postgres and MySQLNov 2022Composite indexes are about 10x faster than index merges. In Postgres, the gap is larger than in MySQL because Postgres doesn't support index-only scans for queries that involve index merges.Napkin MathComposite Index: ~1msIndex Merge: ~...

Click to view the original at sirupsen.com

Hasnain says:

“If you’re wondering if you need to add a composite index, or can get away with creating to single indexes and rely on the database to use both indexes — then the rule of thumb we establish is that an index merge will be ~10x slower than the composite index. However, we’re still talking less than 100ms in most cases, as long as you’re operating on 100s of rows (which in a relational, operational database, hopefully you mostly are).”

Posted on 2022-11-28T00:53:15+0000

placeholder

Recognizing patterns in memory

Something I find frustrating is how hard it is to teach debugging skills. I think the biggest reason is because there are many things that can only be learned through experience. This is true for anything that requires pattern recognition. Our brains are great at recognizing patterns, but it often t...

Click to view the original at timdbg.com

Hasnain says:

“The idea of recognizing a sequences of bytes and finding the meaning behind them has always felt very satisfying to me.”

Posted on 2022-11-25T21:19:43+0000

placeholder

Parents of Ex-Stanford Goalie Suing School for Wrongful Death

Katie Meyer’s family claims Stanford’s handling of a disciplinary process involving their late daughter led to her death.

Click to view the original at si.com

Hasnain says:

““Katie Meyer’s tragic death resulted from Stanford’s egregious and reckless mishandling of its disciplinary process,” attorney Kim Dougherty said in a statement. “Stanford has known for years that its disciplinary process, in its own Committee 10’s words, is ‘overly punitive’ and harmful to its students, yet the school and its administrators have done nothing to correct its procedures. Through this litigation we will not only obtain justice for Katie, but also ensure necessary change is put into place to help protect Stanford students and provide safeguards when students are in need of support.””

Posted on 2022-11-25T18:01:58+0000

placeholder

Hasnain says:

When twitter dies, I’ll pour one out for Dril.

“So far, Dril said, he’s enjoying the spectacle of Musk’s takeover. “Elon seems like one of the classic comedic showmen,” he said. “Everything he does is a comedic bit. He’s always trying to get a laugh, that’s why he makes all his cars suicidal. Just watching everything burn, it’s entertaining, that’s for sure.””

Posted on 2022-11-24T05:48:13+0000

placeholder

Safely writing code that isn't thread-safe - Cliffle

One of the nice things about the Rust programming language is that it makes it easier to write correct concurrent (e.g. threaded) programs – to the degree that Rust’s slogan has been, at times, “fearless concurrency.”

Click to view the original at cliffle.com

Hasnain says:

“Rust is the only language where I regularly write non-thread-safe data structures without caveats or fear. In cases where they apply, such data structures can be simpler and often faster than concurrent thread-safe data structures – with the drawback, of course, that you can’t use threads to speed up operations on them.

If you’re coming to Rust from another language that emphasizes concurrency, such as Java or Go or (increasingly) C, keep this in mind:

You don’t necessarily need to make every data structure thread-safe, and

If you get it wrong, you’ll get a compiler error, not a weird runtime bug.”

Posted on 2022-11-24T04:18:17+0000

placeholder

Hasnain says:

“This is the story of some DC reporters who got upset that they didn’t get invited to a wedding. Nothing more. And naturally, when faced with pushback (such as asking why Cook didn’t bother to read the photo caption), these journalists got even more defensive, arguing that people just don’t understand how journalism works.”

Posted on 2022-11-24T02:10:18+0000

placeholder

Hasnain says:

“But that displacement happens only because building dense housing is illegal in many rich neighborhoods, and because cities build so little of it overall. “If you want to build enough to really help low-income people, you’re talking about doing a lot of building,” Rick Jacobus, an expert on inclusionary housing and the principal of Street Level Urban Impact Advisors, told me.

As it turns out, two economists had, in a way, answered my question. Enrico Moretti of UC Berkeley and Chang-Tai Hsieh of the University of Chicago wanted to know how much GDP and productivity the United States gives up by throttling the housing supply in its biggest cities. In a blockbuster 2019 paper, they found that if New York, San Jose, and San Francisco—just those three cities—had the permitting standards of Atlanta or Chicago over the previous several decades, the U.S. economy would have been roughly $2 trillion bigger in 2009. American households would have earned an average of $3,685 more a year.”

Posted on 2022-11-23T14:58:25+0000

placeholder

Building the fastest Lua interpreter.. automatically!

It is well-known that writing a good VM for a dynamic language is never an easy job. High-performance interpreters, such as the JavaScript interpreter in Safari, or the Lua interpreter in LuaJIT, are

Click to view the original at sillycross.github.io

Hasnain says:

This was a really interesting technical read.

“In this post, we demonstrated how we built the fastest interpreter for Lua (to date) through a novel meta-compiler framework.

However, automatically generating the fastest Lua interpreter is only the beginning of our story. LuaJIT Remake is designed to be a multi-tier method-based JIT compiler generated by the Deegen framework, and we will generate the baseline JIT, the optimizing JIT, the tiering-up/OSR-exit logic, and even a fourth-tier heavyweight optimizing JIT in the future.”

Posted on 2022-11-22T23:26:36+0000