HNHacker News
TopNewBestAskShowJobs

samwillis

30,161 karma · joined March 17, 2008

Multidisciplinary Developer, Designer and Engineer. I invent products both online and offline.

Working on sync engines, PGlite, and Tanstack DB at Neon/Databricks. Previously co-founder ElectricSQL (acquired by Databricks).

sam dot willis at gmail dot com

samwillis.co.uk

Twitter: @samwillis

submissionscomments
samwillis··on Spectral Labs releases SGS-1: the first generative model for structured CAD
> Given an image or a 3D mesh, SGS-1 can generate CAD B-Rep parts in STEP format. Unlike all other existing generative models, SGS-1 outputs are accurate and can be edited easily in traditional CAD software

This is a game changer, all the models before that output meshes were a toy at best. Super excited to see where they can take this.

I wander if the next step is for a step -> proprietary format (SolidWork, NX etc) model that can infer constraints.

samwillis··on ClickHouse vs PostgreSQL UPDATE performance comparison
Really interesting post, and well done on setting up the Apples to Oranges nature of the benchmark, you're very clear. It's really interesting to see the deference the district architectures make.

Did you run any tests with the new transaction system in ClickHouse? It would be super interesting to see how it effected the batch updates.

samwillis··on Eliminating JavaScript cold starts on AWS Lambda
> I haven't kept track of what Oliver's doing here lately

Please do go and check up what the state of using types to inform the compiler is (I'm not incorrect)

On the area allocator, I wasn't clear enough, as stated elsewhere this was in relation to having something similar to isolates - each having a memory space that's cleaned up on exit.

Python has almost identical semantics to JS, and has threads - there is nothing in the EMCAScript standard that would prevent them.

samwillis··on Eliminating JavaScript cold starts on AWS Lambda
> ECMAScript specifies all of the things you're talking about, and that is JavaScript, irrespective of the runtime.

I suggest you go and read the EMCAScript standard: https://ecma-international.org/publications-and-standards/st...

There is nothing in there about browser APIs, and in fact it explicitly states that the browser runtime, or any other runtime + api are not EMCAScript.

samwillis··on Lessons learned from building a sync-engine and reactivity system with SQLite
Do drop into the discord and let me know who you are there. Would love to hear your take on react-native support.
samwillis··on Lessons learned from building a sync-engine and reactivity system with SQLite
Oh cool! I'll absolutely take a look.
samwillis··on Eliminating JavaScript cold starts on AWS Lambda
Web workers don't share memory (other than SAB) with the main thread, they are far from traditional threads. These APIs are designed the way they are to protect end users, stop sites from consuming resources or bad code blocking the main thread. None of that is needed to be that way on the server. There is zero reason that a JS implementation cannot implement proper threads within the same memory space. The issue is that all js engines are derived from the browser where that isn't wanted, they simply don't have support for it. Traditional threads need careful use,

Nowhere did I say that full, or even any, compatibility with Node is needed - it isn't.

We need to stop conflating JS the language with the runtimes.

A JS runtime absolutely can get by without a GC, you just never dealloc and consume indefinitely. That doesn't change any semantics of the language, if a value/object is inaccessible, it's inaccessible...

An arena allocator provides a route to say embedding a js-to-native app in a single threaded web server like Nginx, you don't need to share memory between what in effect become "isolates".

samwillis··on Eliminating JavaScript cold starts on AWS Lambda
The point of the js engine sandbox is to protect the user in the browser - it's completely redundant on the server. Supply chain attacks are real, but only Deno has tried to fix that through permissions/rules.

I don't think anything changes with compile to native on the server.

samwillis··on Lessons learned from building a sync-engine and reactivity system with SQLite
This is a really great write up!

I work at Electric and started the PGlite and now Tanstack DB projects. The issues mentioned with PGlite are one of the major motivating factors behind Tanstack DB. We are taking those learnings and building, what we believe, is the missing client side datastore that is "sync native" and completely backend agnostic. Also being JS, rather than WASM, solves many of the slower than ideal query semantics, and has enabled us to build an incremental query engine for it.

It's also important to note that Electric doesn't require PGlite on the client, far from it - it's essentially a "protocol first" sync engine, you can use it to write into and maintain any client side store.

This solution by the OP, diffing based of modified data is ideal for a huge number of apps, and something that we intend to built into Tanstack DB so you can easily sync with no additional infrastructure.

SQLite (or PGlite) in the browser is awesome, and has the advantage over Tanstack DB at the moment of having persistence (it's on our roadmap), but they are also somewhat chunky downloads. For many local-first apps that's not a problem though.

samwillis··on Eliminating JavaScript cold starts on AWS Lambda
Oliver is doing awesome work here. A few interesting points:

- Porffor can use typescript types to significantly improve the compilation. It's in many ways more exciting as a TS compiler.

- There's no GC yet, and likely will be a while before it gets any. But you can get very far with no GC, particularly if you are doing something like serving web requests. You can fork a process per request and throw it away each time reclaiming all memory, or have a very simple arena allocator that works at the request level. It would be incredibly performant and not have the overhead of a full GC implementation.

- many of the restrictions that people associate with JS are due to VMs being designed to run untrusted code. If you compile your trusted TS/JS to native you can do many new things, such as use traditional threads, fork, and have proper low level memory access. Separating the concept of TS/JS from the runtime is long overdue.

- using WASM as the IR (intermediate representation) is inspired. It is unlikely that many people would run something compiled with Porffor in a WASM runtime, but the portability it brings is very compelling.

This experiment from Oliver doesn't show that Porffor is ready for production, but it does validate that he is on the right track, and that the ideas he is exploring are correct. That's the imports take away. Give it 12 months and exciting things will be happing.

samwillis··on How we made JSON.stringify more than twice as fast
Porffor is doing that, JS -> WASM (an an IR) -> C -> Native

For TypeScript it uses the types as hints to the compiler, for example it has int types that alias number.

Very early still, but very cool.

https://porffor.dev/

samwillis··on HTML-in-Canvas
There is a lot valid concern on accessibility and abuse this could result in, but it think it's important to see the other side of the argument.

There was a really good thread on Twitter a couple of days ago:

> In light of recent Figma news, lemme reiterate that of all the goods that can happen to the web, 90% of them can't happen due to not having access to font rendering & metrics in JS

https://x.com/_chenglou/status/1951481453046538493

And a few choice replies:

> t’s kind of crazy that a platform specifically designed for presenting text doesn’t provide functionality to manipulate text at a detail level

> Brute forcing text measurement in tldraw breaks my heart

Love it or hate it, the web is a platform for application development, making this easer is only good for everyone.

My argument on web APIs is what we should continue to go lower level, and so font and text metrics APIs for canvas would be awesome and an alternative to this. But I'm also a proponent of "using the platform" and for text layout, web engines are incredible, and very performant. Extending that capability to layout inside a canvas enables many awesome features.

One that I've repeatedly gone back to over the years is paginated rich text editing. It's simply impossible to do with contenteditable in a product level way - one of the reasons Google docs has a custom layout engine. This proposal would enable full use of contenteditable for rich text, but with full page/print layout control.

I hope it lands in the browsers.

samwillis··on Show HN: TanStack DB – Reactive DB with Differential Dataflow for TanStack Query
Although we haven't built offline support yet, it is very much planned.
samwillis··on Ask HN: What are you working on? (July 2025)
Tanstack DB - a new client side store for web apps, with transactions, optimistic state, and live queries spanning multiple collections.

It's designed for sync, so rather than fetching you can hook it up to a sync engine (any!) to keep your front end in sync with your backend. It's built on Tanstack Query, making the sync engine optional, and a great path for incremental adoption.

The query engine uses a typescript implementation of differential dataflow to enable incremental computation of the live queries - they are very fast to update. This gives you sub ms fine grade reactivity of complex queries (think sql like joins, group by etc).

Having a lot of fun building it!

https://tanstack.com/db/latest https://github.com/TanStack/db

samwillis··on Breaking the WASM/JS communication performance barrier
Personally I feel this is backwards - I don't want access to js literals and objects from WASM, I just want a way to wrap an arbitrary array buffer that contains a utf16 string as a js string.

It keeps WASM simple and provides a thin layer as an optimisation.

samwillis··on Breaking the WASM/JS communication performance barrier
It's great that the rust community are finding ways to improve the performance of decoding strings from WASM to js, it's one of the major performance holes you hit when using WASM.

The issue comes down to the fact that even if your WASM code can return a utf16 buffer, to use it as a string in JS code the engine needs to make a copy at some point. The TextDecoder api does a first good job of making this efficient, ensuring there is just a single copy, but it's still overhead.

Ideally there should be a way to wrap an array buffer with a "String View", offloading the responsibility of ensuring its utf16 to the WASM code, and there being no copy made. But that brings a ton of complexities as strings need to be immutable in js, but the underlying buffer could still be changed.

samwillis··on Local-first software (2019)
Along with the others mentioned, it's worth highlighting Yjs. It's an incredible CRDT toolkit that enables many of the realtime and async collaborative editing experience you want from local-first software.

https://yjs.dev/

samwillis··on Local-first software (2019)
> This is trying to solve a business problem (I can't trust cloud-providers) with a technical trade-off (avoid centralized architecture).

I don't think that's quite correct. I think the authors fully acknowledge that the business case for local-first is not complexly solved and is a closely related problem. These issues need both a business and technical solution, and the paper proposes a set of characteristics of what a solution could look like.

It's also incorrect to suggest that local-first is an argument for decentralisation - Martin Kleppmann has explicitly stated that he doesn't think decentralised tech solves these issues in a way that could become mass market. He is a proponent of centralised standardised sync engines that enable the ideals of local-first. See his talk from Local-first conf last year: https://youtu.be/NMq0vncHJvU?si=ilsQqIAncq0sBW95

samwillis··on Local-First Software Is Easier to Scale
Local-first is the true server-less and your device is the real "edge".

So much truth to this post.

samwillis··on Local-first software (2019)
There is now a great annual Local-first Software conference in Berlin (https://www.localfirstconf.com/) organised by Ink and Switch, and it's spawned a spin out Sync Conf this November in SF (https://syncconf.dev/)

There was a great panel discussion this year from a number of the co-authors of the the paper linked, discussing what is Local-first software in the context of dev tools and what they have learnt since the original paper. It's very much worth watching: https://youtu.be/86NmEerklTs?si=Kodd7kD39337CTbf

The community are very much settling on "Sync" being a component of local first, but applicable so much wider. Along with local first software being a characteristic of end user software, with dev tools - such as sync engines - being an enabling tool but not "local first" in as much themselves.

The full set of talks from the last couple of years are online here: https://youtube.com/@localfirstconf?si=uHHi5Tsy60ewhQTQ

It's an exciting time for the local-first / sync engine community, we've been working on tools that enable realtime collaborative and async collaborative experiences, and now with the onset of AI the market for this is exploring. Every AI app is inherently multi user collaborative with the agents as actors within the system. This requires the tech that the sync engine community has been working on.

samwillis··on Wrong ways to use the databases, when the pendulum swung too far
I think a lot of the problems come from the fact testing stored procedures ventures into e2e testing land. You have to stand up infra in order to test them. There's not really been a simple way to unit test stored procedures as part of your application codes testing framework.

(Aside: I think this is something PGlite helps with if your in Postgres land)

samwillis··on Ask HN: How do you teach your kids about AI?
I spent an afternoon vibe coding a game with them (10 + 6). We took it in turns describing what to build, and I did my best to explain that the AI was interpreting our instructions and writing to code. They could see the code changing and sort of understood the concept from that.

Key thing I tried to emphasise what that this whole process was new and that before November last year wasn't possible.

They really got it, my younger son is very excited about the idea of build games that follow the stories he comes up with (he's recently been spending time writing stories on a iPad, inspired by his novelist mother). We're going to spend more time experimenting together over the summer holidays.

Kids are curious sponges, I don't think you need to spell out to them exactly how it works, just show them and their curiosity takes over.

I know at school the teachers have been using image GenAI in English lessons with my older daughter, using it in lessons about descriptive language. They have had the kids experiment with describing things and getting images back. I was quite impressed to hear they were doing that, it's a great way to introduce the concepts in the context of a topic they are covering.

On the general topic of tech we have always (from as soon as they could hold a device) let the kids play computer games, and experiment themselves with tablets. But we've had the internet locked down, and not let them have things like YouTube Kids, it feels too close to social media, and serve explained the dangers of that to them. So very pro exposing children to tech, but no social media at all. I think in time we will try and explain the danger and downsides of AI, but it's all so new, there's not much to cover yet, particularly as we are still developing our own opinions.

samwillis··on Apple's Liquid Glass is prep work for AR interfaces, not just a design refresh
This would make sense if there was any indication that AR is going to happen. I would argue that there isn't even the faintest signal that it will.

People do not want invasive glasses, even if they make them as small at normal glasses. I just don't see it becoming anything other than a niche product.

It's like all the moves to voice/audio interfaces powered by AI. They simply won't take off as audio is inherently low bandwidth and low definition. Our eyes are able to see so much more in our peripheral vision, at a much higher bandwidth.

Some would argue that's an indication that AR will happen, but it's still so low deff, and incredibly intrusive, as much as I love the demos and the vision (pun not intended) behind it.

As far as I can see, the only motivation for the visual overall is that they need something to fill the gap until they have some real AI innovations to show. This is a "tick" in the traditional "tick" -> "tock" development and release cycle - a facelift while they work on some difficult re-engineering underneath. But that's not AR, it AI.

samwillis··on Test Postgres in Python Like SQLite
This is something I've explored as part of my work on PGlite. It's possible but needs quite a bit of work, and would come with some limitations until Postgres upstream make some changes.

You will need to use an unrolled main loop similar to what we have in PGlite, using the "single user mode" (you likely don't want to fork sub processes like a normal Postgres). The problems come with then trying to run multiple instances in a single process, Postgres makes heavy use of global vars for state (they can as they fork for each session), these would clash if you had multiple instances. There is work happening to possibly make Postgres multi-threaded, this will solve that problem.

The long term ambition of the PGlite project is to create a libpglite, a low level embedded Postgres with a C api, that will enable all this. We quite far off though - happy to have people join the project to help make it happen!

samwillis··on Test Postgres in Python Like SQLite
Awesome work Wey! Love that you're building this!

I work on PGlite, we have an experimental WASI build that can run in a WASI runtime, it should enable dropping the Node requirement. It lacks error handling at the moment (WASM has no long jump, and Postgres uses that for error handling - Emscripten has hacks that fix this via JS), and so we haven't yet pushed it far.

Do ping me on our Discord and I can point you towards it.

Happy to answers any PGlite questions while I'm here!

samwillis··on Father Ted Kilnettle Shrine Tape Dispenser
Two ways to make it:

- know the total length of the tape, and when it's changed, and therefore predict the current radius of the roll

- a small sprung variable resistor pressing against the under side of the role

But that could be over-engineering something that almost more perfect if it's a little imperfect.

samwillis··on OpenAI: Scaling PostgreSQL to the Next Level
Hey! It was great to meet you at the conference, it's a great writeup!
samwillis··on OpenAI: Scaling PostgreSQL to the Next Level
No worries, it was a really great talk - one of the highlights of the conference for me!
samwillis··on OpenAI: Scaling PostgreSQL to the Next Level
Going to PGconf.dev, explaining what you are doing to the core devs, the problems you faced, and what you would love to have as feature in Postgres, is exactly the right way to go about improving Postgres.

Blindly opening "PRs" (Postgres doesn't work in this way, it's diffs on a mailing list) would not get you anywhere very fast. You need buy in and consensus from the wider development team.

samwillis··on OpenAI: Scaling PostgreSQL to the Next Level
I believe the videos of the talks will be published at some point - I think "a few weeks" was mentioned.
← PreviousPage 2 of 34Next →