HNHacker News
TopNewBestAskShowJobs

leontrolski

2,204 karma · joined March 29, 2019

https://leontrolski.github.io/
submissionscomments
leontrolski··on Pgtestdb's template cloning approach to testing is fast
Agreed, benchmarking, I only see a slight speedup on MacOS - https://github.com/leontrolski/postgresql-testing#:~:text=ra...
leontrolski··on Pgtestdb's template cloning approach to testing is fast
Being to lazy to think or test it - does the above reset SEQUENCEs?
leontrolski··on Pgtestdb's template cloning approach to testing is fast
I concur with this approach. TRANSACTION-y tests (the default in Django) often don't quite line up with reality and make it hard to eg. drop in a breakpoint and run a server against the test's db state.

I've experimented (see below) with TEMPLATE dbs and such in Python (with inspiration from this library). IMHO the "around 100ms" mark is pretty slow for a big test suite. Interestingly, pg_restore is only twice as slow as TEMPLATEs.

https://github.com/leontrolski/postgresql-testing

I'd be interested about how all this compares to snapshotting the postrgres dir with ZFS and restoring to that, but don't have a Linux box to hand.

leontrolski··on Pip install Postgres – no Docker/Brew/apt
Some discussion on (ab?)using pypi to distribute binaries - https://discuss.python.org/t/use-of-pypi-as-a-generic-storag...
leontrolski··on (How to Write a (Lisp) Interpreter (In Python)) (2010)
Similarly - 80 line LISP interpreter with integers, lexical scope, first class functions

https://leontrolski.github.io/interpreter.html

leontrolski··on All of human cooking compressed into 2 megabytes
Neat.

I'm trying to compress recipes into little schematics https://leontrolski.github.io/recipes.html

leontrolski··on Generalised plusequals
What would be the equivalent to this in Haskell (with or without lens):

    cat = Cat(age=3)
    l = [1, [2, cat], 4]
    alt l[1][1].age.=9
That would give us l equal to:

    [1, [2, Cat(age=9)], 4]
leontrolski··on Generalised plusequals
This is surprising to me:

  l[1][1].age:9
  # (1,(2,{"age":9}),4)
How come it doesn't return just:

  {"age":9}
Or is there something totally different going on with references here? As in, how is this different to:

  l_inner = l[1][1]
  l_inner.age:9
leontrolski··on Is anybody else bored of talking about AI?
Yes, AI or no AI, tell me about something actually interesting that you're working on.

Currently it feels a bit like everyone is talking about what new editor they're using. I don't care about that type of developer tooling very much. AI isn't coming up with some exciting new database, type system, etc etc.

"Look at how I'm able to web dev x% faster" because of LLMs is boring.

leontrolski··on Venn Diagram for 7 Sets
Ditto, another Upset blog post - https://leontrolski.github.io/upset.html
leontrolski··on A Early History of Algebraic Data Types
Lovely writeup!

> Pascal did not have sum types because Wirth thought they were less flexible than untagged unions

I'm not sure whether my dream language would have tagged or untagged unions (Scala 3 has both it seems). I'd be interested if anyone has any further points of comparison beyond:

Tagged unions, eg. in Rust: enum Tagged {A(i64), B(String), C(f64)} Untagged unions, eg. in typed Python: Tagged = int | str | float

Tagged unions are better as you can represent duplicated types and types with no data, eg: enum Tagged {A, B(f64), C(f64)}

Untagged unions are better as you can willy nilly create new subsets and intersections of types. I find often in AST-ish work I want to express eg: def f(x: A | B | C) -> A | B

leontrolski··on Do not download the app, use the website
A reminder of all the features available right now with PWAs - https://whatpwacando.today
leontrolski··on Postgres LISTEN/NOTIFY does not scale
> also fast when transactions are held open

In my linked example, on getting the item from the queue, you immediately set the status to something that you're not polling for - does Postgres still have to skip past these tuples (even in an index) until they're vacuumed up?

leontrolski··on Postgres LISTEN/NOTIFY does not scale
I'd be interested as to how dumb-ol' polling would compare here (the FOR UPDATE SKIP LOCKED method https://leontrolski.github.io/postgres-as-queue.html). One day I will set up some benchmarks as this is the kind of thing people argue about a lot without much evidence either way.

Wasn't aware of this AccessExclusiveLock behaviour - a reminder (and shameless plug 2) of how Postgres locks interact: https://leontrolski.github.io/pglockpy.html

leontrolski··on Show HN: Tkintergalactic - Declarative Tcl/Tk UI Library for Python
I plan on using it for semi throw away UIs for things where I don't want the user to have to spin up a Web server. Right now there's no canvas support, but there is that kind of thing in the Tk/Tcl docs (linked in the project). I probably need to add a way to reference a specific Widget so you can access the raw name and run taw Tcl against it.
leontrolski··on Show HN: Tkintergalactic - Declarative Tcl/Tk UI Library for Python
Well that was dumb - fixed, sorry
leontrolski··on Show HN: TinyJs React like framework in 35 lines of code
33 line React https://news.ycombinator.com/item?id=22776753
leontrolski··on Zod: TypeScript-first schema validation with static type inference
For those of you from a Python background - this is basically "Pydantic for Typescript". See also trpc - cross client/server typing using zod under the hood - https://trpc.io/
leontrolski··on JavaScript dates are about to be fixed
Here's a nice modern Python library in this space that claims to take influence from Temporal and Chrono - https://github.com/ariebovenberg/whenever
leontrolski··on Rye: A Hassle-Free Python Experience
If like me, you've ignored poetry and friends and stuck with pip-tools (congrats!), uv (used by rye internally) is a drop in replacement.

IMHO pip-tools was always the far nicer design than poetry, pipenv etc as it was orthogonal to both pip and virtualenv (both of which have been baked into Python for many years now). I would argue Rye is the iterative, standards compliant approach winning out.

Beyond the speedups from Rust, it's nice to have some opinionated takes on where to put virtualenvs (.venv) and how to install different Python versions. It sounds small, but since wheels fixed numpy installs, sane defaults for these and a baked in pip-tools is basically all that was missing. Talking of which, what has been the point of anaconda since binary wheels became a thing?

leontrolski··on Arthur Whitney releases an open-source subset of K with MIT license
For what it's worth, there are some benchmarks of kdb+ (the database built on k) here - https://tech.marksblogg.com/billion-nyc-taxi-kdb.html (it's overall a fantastic series of blog posts).
leontrolski··on Reviving PyMiniRacer: A Python <> JavaScript Bridge
I'm always excited by the idea of rendering jsx from Python in the same process. Mostly as a bridge between eg. an existing Django app and full SPA React land. You'd swap out the scrappy Django string templating with jsx, then once a page passes some frontend interaction complexity threshold shift it over entirely (with shared components between both). Could this project help achieve this or are imports/build processes etc too much of an impediment?
leontrolski··on Postgres as queue
Thanks for the comprehensive reply, does the following argument stand up at all? (Going on the assumption that LISTEN is one more concept and one less concept is a good thing).

If I have say 50 workers polling the db, either it’s quiet and there's no tasks to do - in which case I don't particularly care about the polling load. Or, it's busy and when they query for work, there's always a task ready to process - in this case the LISTEN is constantly pinging, which is equivalent to constantly polling and finding work.

Regardless, is there a resource (blog or otherwise) you'd reccomend for integrating LISTEN with the backend?

leontrolski··on We Built a Streaming SQL Engine
Ahh, I see you're a cofounder at feldera :)

I have a couple of dbsp questions if you're feeling generous and have 10mins free - reach out ojhrussell at gmail

leontrolski··on We Built a Streaming SQL Engine
I didn't - I wanted to build something I could understand, and the rust implementation comes with a load of (reasonable) complexity, some resulting from the execution model, some from performance requirements.

stepping has 3 Zset implementations - in memory, sqlite and postgres. Currently considering whether to write a small rust one.

There's some more details here: https://stepping.site/docs/internals/how-it-works/

leontrolski··on We Built a Streaming SQL Engine
I've been playing around with writing an application-orientated Incremental View Maintenance library along these lines:

https://stepping.site

It's based off of the DBSP paper, which counts Materialize's Frank McSherry as an author. Definitely not ready for the prime time, but any feeback welcome!

leontrolski··on That people produce HTML with string templates is telling us something
See also "What if we'd had better html-in-js syntax all along?" https://leontrolski.github.io/dom-syntax.html
leontrolski··on Behind the Veneer: The South Shoreditch Furniture Trade and Its Buildings [pdf]
It's still possible to get furniture made in the area - https://www.untothislast.co.uk have a workshop at the top of Brick Lane that you can visit. They also deliver by cargo bike which can look pretty impressive for the larger items.
leontrolski··on Ask HN: Why is Python package management still a dumpster fire?
I wrote a short guide for confused node developers at work a while ago https://leontrolski.github.io/virtualenvs-for-node-devs.html
leontrolski··on CycleStreets route planner – how it works

  It has been pointed out that this is apparently similar to Djikstra's algorithm although when it was written the author wasn't aware of that.

  The inspiration for the algorithm comes from a solution to a problem set in a mid 1980s edition of A&B Computing magazine.
Page 1 of 3Next →