HNHacker News
TopNewBestAskShowJobs

smj-edison

875 karma · joined February 20, 2024

Email is: stephen dot mason dot jones at the big alphabet company.

Github is https://github.com/smj-edison/

submissionscomments
smj-edison··on Libghostty 1.0
Ooh, will take a look at this, since it's directly applicable!
smj-edison··on Libghostty 1.0
I'm currently working on my own Zig project (an interpreter) and right now I'm working on designing a C interface for it. Seeing things mentioned like having objects as opaque handles, or enum-keyed getters and setters, made me think about how clunky my current API is, since I leak too many details to callers.

What really caught my attention was this: "So from the start, I took inspiration from C libraries I enjoyed working with and designed the API to have a strong, stable ABI that allows for future additions." What are good examples of this? I feel like I just don't have enough experience with well-designed C libraries to know what to look for.

smj-edison··on Show HN: I've updated my Linux System Call website and API
I think it's a bit unfair to mainly focus on the API surface while ignoring a lot of internal details. Linus has talked about how Linux will often have massive amounts of internal code change between releases, while the API surface stays the same. So yeah, the API might be old and crufty, but it's also been around for 30 years. And as long as the API is sufficient, it's the internals that are a lot more interesting. Radically redesigning the API every few years would just accelerate towards XKCD 927, because of backwards compatibility.
smj-edison··on AI isn't replacing SREs, it's deskilling them
“The purpose of abstraction is not to be vague, but to create a new semantic level in which one can be absolutely precise.” — Edsger Dijkstra

I've thought a lot about this quote, and the best abstractions I use are absolutely this. I love array indexing as an abstraction, but in the back of my head I have pointer + index * size. I like having the kernel do memory mapping, but I know there's a buddy allocator and TLB cache there.

smj-edison··on Gemini 4 Carbon is the new #1 on the Artificial Analysis Intelligence Index v5
Agreed on the limits, they're quite frustrating. I've still been preferring Argon to Opus 5.5 though, because even though Argon gets details wrong, I find that it's much more creative and willing to explore ideas. In my experience Opus tends to be rather condescending and won't make room for less orthodox ideas to develop. For what I'm doing, I'd much rather have good ideas that I implement mostly by hand rather than regressing to the mean and have the LLM write the code.
smj-edison··on Three new discoveries in mathematics, computer science, and physics
One other thought, I think another aspect of biological sciences is just how much effort it takes to do research. Hypotheses are a dime a dozen, but actually verifying these is quite difficult. It takes a lot of patience, time, attention to details, and even then it often fails to replicate.

I don't think LLMs will just magically be able to connect all the dots, because "garbage in, garbage out" still applies. And there's just too many invisible intermediate states, there is literally just not enough information to fully constrain a model. Hence my interest in scaling computational chemistry to get these intermediates :)

smj-edison··on Three new discoveries in mathematics, computer science, and physics
Heh. Unfortunately computer science is really the weird one out where open source is the norm. A lot of computational chemistry knowledge is mainly transferred in research labs and through college classes, and you have to pay for a lot of the tools. But hopefully I can at least point you in some useful directions. Here's a bit of an overview of the CC workflow and free options (note I haven't tried all the free options):

1. The first thing you need to do is start with some atomic structure. You can often find pre-existing pieces (through websites like pubchem), but you need to cobble them together. I use chemcraft and gaussview for this, but those are paid options. I've heard good things about the FOSS program Avogadro though.

2. Once you've built the structure of interest, you want to calculate properties of it. Note that we only infrequently simulate the atom's movement, since that's quite expensive. There's a lot of techniques that let us get the most bang for buck, like calculating transition states, or states of lowest energy which we call intermediates, or running something called an IRC, which follows the molecule to its lowest energy point (note we pretty much always think about these things in terms of energy). The traditional programs I use for this are Gaussian and ORCA (ORCA is free but you do have to create an account on their forum). Newer methods include MACE and orbmol, which are pretty much only used for trajectories (e.g. running through time) as far as I know. This newer crop of programs are much more FOSS, but they aren't as rigorous so my lab uses them only as a "rough draft". I pulled in one of my current notebooks if you're curious to try it out: https://github.com/smj-edison/qc-tools/blob/main/examples/ml...

3. Interpreting results/debugging problems. This is currently done in my workflow using a python script to extract values from the job runfiles (oh yeah, did I mention the terrible DX? A lot of this stuff is done by hand-writing a job text file and then using regex to parse the logfile). We do a lot of analysis based on relative energies (this is something called transition state theory of reactions).

I definitely glossed over a lot of details, but this is long enough as is. Definitely let me know if you have questions! If you do want a "hello world" though, I'd definitely check out the notebook I linked to. You'll have to create a file called "start.xyz" with some sort of chemistry program (or use AI to pull one for you), and then you can run the system through time. I would use a system I'm researching right now, but I'm not sure what our lab's policy is on broadcasting things to the world.

smj-edison··on Three new discoveries in mathematics, computer science, and physics
Computational biochemistry is what I'm currently pursuing, but I'm pretty new to the field so take everything I say with a grain of salt: Biochemistry is a really really really tricky problem, for a couple reasons:

1. Biology has a very nasty habit of not cleanly abstracting. It's not like we can treat every protein as a "diffuse mass" without losing a ton of important interactions. This is unlike something like CFD where you can treat a mass of water molecules with certain constants. Think of something like cancer: a small mutation to a DNA strand can cascade into a tumor. You have to deal with the mutation happening at an atomic level while scaling to a whole organism (yes I know there's models that can approximate this, but they can't capture all the interactions).

2. This brings us to modelling at the atomic level. To model a system of atoms with the Schrödinger equation, it naively scales O(6^n) per particle. Note that means every nucleus and electron, so if you have say 10 carbon atoms and 22 hydrogen you're already at 10^127 operations. We can cut corners a bit and end up with something like CCSD which scales O(n^7), or cut more corners and scale O(n^3) for DFT. DFT is pretty much the last method where bond forming and breaking is modelled, so after more corner cutting you lose losing reactions, which are important for understanding why something is happening. Most protein folding simulations (moreso prior to alphafold) run a very crude approximation that models atoms as balls on springs (things like AMBER and CHARMM), which obviously can't handle reactions.

3. If this wasn't bad enough, you also can only move through time at about 1 femtosecond (10^-15), so it takes a ton of simulation steps to get even a nanosecond in. Forget millisecond or second lengths where things start to happen.

So, while the math of the physics exists, computationally it's practically intractible. There's some exciting work with something called Machine Learning Interatomic Potentials (MLIP) which approximate DFT using a neural network which are about 1000x faster than DFT, and iirc scale much more linearly (look at things like MACE and orbmol if you're curious). So we're making progress, but we've gone from so ridiculously impossible to pretty much impossible for large systems.

I have a couple ideas about developing custom microchips to make this faster, which is why I'm pursuing this, but there's still a massive way to go!

smj-edison··on Rust Style Guide
The problem with lifetimes is they become a object tree, where Rc and co let you represent an object graph (well, a DAG at least). So when your problem resembles a tree, it's great, but some problems don't like being forced into that shape.
smj-edison··on Rust Style Guide
You don't have to deal with Rust's aliasing rules for &mut and &.
smj-edison··on Using Claude to reduce the attack surface of code
https://github.com/digama0/thinking-sand
smj-edison··on C for Rust programmers
Unless you use cgroups or turn off overcommit :) I'm also hoping to use the core interpreter on memory-limited devices like an ESP-32.
smj-edison··on C for Rust programmers
Oh that's exciting! I knew about the allocator work, but I hadn't heard about error reporting for failed allocations, or that it was about to be stabilized.
smj-edison··on C for Rust programmers
I'm one of those people who's adopting Zig :) But I don't think it's best for every project. For context, I've used Rust before for probably two years writing a realtime audio synthesis engine, so I'm fairly familiar with Rust vs Zig for handling low level details.

The biggest reason I use Zig is it's a very explicit language. The creators made a very intentional decision to avoid too many "high level" designs. This doesn't mean there's no capabilities for abstraction (comptime is great for that), but when you see array indexing, you can think "ptr + index * size with bounds check". There's lots of other things like that where the language does exactly one thing, and that thing is a low level operation.

This is terrible when you want to create high level abstractions that hide details from the programmer, but it's what I need when doing realtime audio synthesis or what I'm doing now which is writing an interpreter. I know exactly what allocates, I know what calls IO and can block (both operations explicitly take in an allocator or IO parameter), no data structures have private fields so I can always poke around at the insides. I know what types of errors a function returns, and creating errors is cheap with Zig's error union design.

So I don't use Zig because I think it's the safer language, I know it has sharp edges because of the number of times I've caused a panic on a poisoned pointer or use-after-free. But because it gives me such a transparent view into what is happening I find it liberating.

smj-edison··on C for Rust programmers
I think this is fair the majority of time, but I'd like to mention Zig, since Zig has a convention of all allocations being fallible and handled. It's a pain at first to handle error.OutOfMemory at each allocating site, but I feel like I'm much more conscious of where allocation can fail and how to gracefully handle it. I've also gotten a lot better at transactions since pretty much every operation has failure points now.

In fact I've written a whole interpreter that can recover from OOM by raising a recoverable exception to the user. It's really only because Zig made recovering idiomatic, and I'm not sure I could've done it in another language (maybe Rust but I'd have to rewrite large parts of stdlib to both return an error and take a custom allocator).

smj-edison··on The Future of Mathematics
> Despite the uncertainty, there are some clear messages we can send to the next generation of mathematicians. The first is that we stand with you. ...Second, mathematics is as important today as it ever was, and we need you. AI must not replace our collective ability to reason and deliberate, and mathematics remains a core capacity for doing so. We cannot imagine a world in which mathematics does not play an important part in our lives.

This is a really uplifting message. I'm currently in school pursuing a degree in applied math, and I've definitely felt unsettled with the recent advancements with automated proving. So it's nice to know that there's still a place for learning mathematics, and that we can find a new way forward.

smj-edison··on Homa: The end of TCP for AI clusters [video]
I remember reading about their setup and it blew my mind. They have MEMS mirrors that can rotate to redirect one of thousands of fiber lines into any other fiber line by using other optics. That way you can take in like 1000 lines and optically connect it to any of the other 1000 lines.
smj-edison··on Climate is accumulating 4 Hiroshima atomic bombs worth of heat per second
Economic viability is how we support human civilization, no? Economics is literally observing how humans interact and prioritize scarce resources like time and materials. So being not economically viable means it not happening.

Is your goal to reduce global temperatures? If so, it needs to be a sustainable effort. You don't get sustainable effort without economic viability.

If your goal is to dramatically reduce temperatures in the next 5 years, why not dump SiO2 in the atmosphere? That would bring the temperature down pretty fast by reflecting out sunlight in the upper atmosphere.

But if your goal is long-term change, we need an approach that works long-term.

Edit: sorry I forgot to mention your point on coal vs natural gas efficiency, I didn't realize it was not that much gain. I still think it's worth it though, since it's still making progress.

smj-edison··on Climate is accumulating 4 Hiroshima atomic bombs worth of heat per second
Honestly burning natural gas is much better than producing electricity with coal, and we can retrofit existing coal generation plants with natural gas and be like 85% cleaner. I'm kind of fed up with the absolutist takes of "don't use any fossil fuels," since that's just completely unreasonable in the next 10-20 years. Setting up power plants takes massive investment, and excluding AI-driven demand, there's not much money in power generation.

Solar has been making incredible progress, and works in sunny locations, but it's not a general purpose solution. Nuclear is getting there, but it's still too expensive and over regulated. I can't say much about wind as I haven't looked into it enough to say. Both thermal and hydro are location dependent, so good when it works but not a general purpose solution.

So that leaves coal and natural gas. We have a lot of both, but switching over to natural gas to coal by retrofitting existing power generation would make a massive difference imo.

At the end of the day, we want diversity in the power grid, not just one thing for every place, since every place is different/has its own history.

smj-edison··on Writing Efficient C++ Code (2013)
Not sure if this is relevant, but I was in a discussion about heap layout a while ago, and one of the commenters was talking about how they were able to have classic lisp-style linked lists with decent performance by using a copying garbage collector: https://ziggit.dev/t/memory-layout-suggestions-for-tcl-inter...

Or were you referring more to all the intermediate allocations that aren't the object heap? V8's zones are interesting in this area, because they're like an arena, except that they're only partially reset when a zone ends, so zones can nest inside each other.

smj-edison··on Writing Efficient C++ Code (2013)
It's interesting because I tried to follow this advice when I wrote my own interpreter, but either 1. I just had a bad intuition and it's gotten better, or 2. It's trickier with interpreters when you have thousands of objects.

For example, since I allowed for objects to be shared between threads, I decided to use struct of arrays so the reference count, metadata, and value would be stored in separate cache lines. This ended up hurting me because object initialization touched three separate cache lines (obvious in hindsight, but the advice of using SoA failed me here). I also heard that you want to pack your values as tight as possible, so I used a packed string index, but then I ended up with integer division to unpack the string (also a mistake, but again the advice failed me). I used a custom allocator to avoid indirection with lists (list items were allocated directly after the list head), but then I had heap fragmentation and the implementation complexity exploded.

Anyways, I am now happily using two to three levels of indirection in my data structures, large structs, and malloc for individual objects, and it's still been faster in my end to end testing. So maybe this is unique to interpreters, and maybe I could have done it better, but the suggestions don't automatically apply in my experience.

smj-edison··on You can defeat the Dream Devourer from Chrono Trigger using an int overflow
Corridors of Time is still sublime. After I heard that song I had to figure out the notes. Turns out there's this random tool that turns game music rips into midi, so I was able to figure out the chords in that song. I still play it from time to time.
smj-edison··on What Zig felt like, coming from Rust
Doesn't comptime run under the target's float and endianness semantics? I need to check, but I believe they emulate the target when evaluating.
smj-edison··on One year of sponsored Servo development
I think if someone is maintaining open source software, they're already not worrying about making that much money.
smj-edison··on A misalignment of AI in mathematics
> while human math capability will not.

I actually partially disagree with this. What happened to all the excitement about Intelligence Augmentation (IA)? Now it's AI instead of IA. I think there's so much untapped potential for augmenting our intellect with the likes of https://dynamicland.org and https://folk.computer, as well as the work that's been going on in college math education, things like Lean, etc. I think the only reason human math capabilities haven't expanded that much is a failure of our imagination, not our potential.

smj-edison··on Casey Muratori – The Root of the Root of All Evil – BSC 2026 [video]
How do you even measure those? Will that show up under something like VTune?
smj-edison··on Show HN: The load-bearing vocabulary of Claude
TIL that agile has its own words for everything.
smj-edison··on Show HN: The load-bearing vocabulary of Claude
Yeah, I once asked it to review its own writing with a subagent with a pretty strict writing guide, and it didn't see anything wrong, lol.
smj-edison··on Show HN: The load-bearing vocabulary of Claude
I like to imagine that there's this one employee that oversees RHLF, who has a particular style of writing, and that got so ingrained that it's just them x1000.
smj-edison··on FDA authorizes first wearable device that monitors ketone and blood sugar levels
Tbh those sound more like Mast Cell Activation Syndrome (MCAS) symptoms...
Page 1 of 15Next →