Better HN
topnewbestaskshowjobs
Log inSign up

rtpg

21,270 karma · joined Nov 23, 2012 (14y ago) · 6,736 submissions

real name: Raphael

blog: https://rtpg.co

email: raphael at above domain

Submissions

comment 6mo ago · link · parent

It sounds like this isn't a cost problem but a supply problem. At one point a 20% reduction in inputs has to affect some output.

comment 6mo ago · link · parent

I do wonder if it'll ever be possible to get Rust tests to feel as nice to write as, say, test suites in Python or Ruby. I might just be missing a lot of helpers, but a part of me really wants to use a test metalanguage that (for example) RC's everything, gives me implicit casts from strings to what ever type I need, and a bunch of other stuff.

I've always found Rust object buildup to be pretty annoying.

comment 6mo ago · link · parent

> When programming in Node I find in practice async and "colored functions" no issue especially with async await. Except for performance issues they come with sometimes but not at a programming level.

JS solves this problem in two ways in the ecosystem:

- basically saying "all functions must be async" in practice

- allowing you to await a non-awaitable ("await 3" is valid)

so library authors can "force" async/await, but users don't actually have to interact with it when they don't need to. But "everything" being async/await means it's all 'basically fine' anyways

There's also the fact that JS libraries tend to be "pass in a bunch of callbacks" vs, say, Python's "override this class". It makes it much easier for libraries to have everything be async and have it really not get in the way.

Python libs tend to have much larger API surfaces due to how OOP works. So async-y internals works are harder to isolate cleanly without breaking the public API. But if you make your API "async-first" then the debugging experience in Python is miserable (try pdb'ing your way through awaitables....)

Even here though there are problems. For example, I've tried in the past to replace some lib with a more performant WASM-y thing. But it couldn't be a drop in replacement because the original library was a sync-only API, and the replacement was async!

Something very silly: you write "function add(x, y) { return x+y }". A bunch of people do things like "add(add(x, y), z)" everywhere. You find out you could make "add" "better" with async/await. You now have to get all callers to rewrite.

So what everyone does is just throw _everything_ in to the async/await pile. Which... I guess is fine but I personally dislike writing "await add(await add(x,y)), z)".

(aside: Rust's postfix await at least makes this kinda refactor less annoying)

comment 6mo ago · link · parent

> It's easy to call low-restriction functions from high-restriction ones and not the other way around.

do you have an example in mind when you say this? I think there's some unique messes with async/await (especially when combined with OOP and extension points... either your extension points _all_ have to be async or you have to have awkward restrictions), in a way that, say, permission checks don't have IMO.

a syntax-less "await function" that climbs up the stack trace to whoever is waiting and holds onto the suspension _is_ a way out of the problem the article describes. Requires runtime support but it effectively means you can always suspend.

comment 6mo ago · link · parent

My sample size is pretty small but when I've witnessed people (both PMs and engineers) "design through AI" I have seen two flavors:

- aimless AI wandering, leading to pretty, frankly, useless design docs

- using AI to "expand" upon a bullet pointed/shorthanded design doc. To which I feel like saying "the bullet points are already a good design doc!"

I understand that teams sometimes have specific formats that they have to make deliverables for, but having a nice 5 point bulletpoint list turn into 5 paragraphs... all for me to turn the 5 paragraphs back into 5 bullet points in my notes is depressing.

I do think you can get a lot of value in the mechanics, I just have had so much success leaving the thinking to me and the rote stuff to the AI. I'm going to have to think about the design eventually anyways right?

comment 6mo ago · link · parent

tbh I'm just confused at why people ask AI to design features. Do you not know how to design a feature? Do you not know what you want?

This stuff works so much better when you just tell it what to do

comment 6mo ago · link · parent

I kinda like react with hooks but I do miss Angular 1 watches. Explicit watch expressions solve a loooot of spurious rerendering nonsense that makes for a lot of churn

Ultimately I think React makes it too hard for the performant solution to be used. And then tries to handwave it all away with “the react compiler solves/will solve it”. Don’t even get me started on “useMemo is not semantics” rationalization. First time runs actually matter when working on a performant UI!

DOM ops are expensive but your little bespoke function component code is also expensive when some hook leads to recalcs all over.

comment 6mo ago · link · parent

yeah nobody "has to know", especially if everyone else is also rebasing etc constantly.

comment 6mo ago · link · parent

> Still haven't found a decent thai or indian restaurant in Japan, and probably never will, given the general aversion for strong spices.

are you not in Tokyo? Because “no decent Thai restaurant in Tokyo” is a wild claim

You can get spicy food in Tokyo! It’s just not going to be all the restaurants. You gotta to to the right place. But you don’t need 100 good thai restaurants to eat dinner, you just need the one.

comment 6mo ago · link · parent

It’s all kinda silly because there’s a “quantity is quality” thing going on with pizza and a lot of “commoner food”.

But Tokyo has a loooooooot of good food from various places, and a lot of people with money willing to spend 5 bucks a slice (for example). Or at least enough to sustain one restaurant.

The contrapositive: what magical thing exists in Jersey that would not be exportable to Tokyo?

I would bet that NYC has the best cheap slice tho.

comment 6mo ago · link · parent

The distinction here is on application vs library, IMO. I basically agree that applications, as a default, `==`'ing everything makes sense.

For libraries, having loose bounds might mean that users upgrade and hit issues due to a lack of an upper bound. But given how lightly maintained most projects are, the risk of upper bounds simply getting in the way are higher IMO.

(Put an upper bound if you know of an issue, of course!)

It's a bit tricky though. Django deps in particular tend to want to explicitly check support for newer versions, but the more I think about it the more I ask myself if this is the right strategy

comment 6mo ago · link · parent

Makes sense, yeah.

comment 6mo ago · link · parent

> no way to delete an account you create

In here it sounds like this is a client to a third party service. Mail.app and Thunderbird don't have buttons to delete my Gmail account

I do agree all of this seems basically like "sure, fine". Just seems rough to get pinged with all of these in a slow stream, and having wall clock time go waaaaaay up for it.

comment 6mo ago · link · parent

what is the value of an "update or insert" call on `Map`? is that not just set?

`getOrInsert` here seems to be the Python "set_default" method on dicts, which is very useful at avoiding tedium in some basic data munging

comment 6mo ago · link · parent

There's something quite illuminating with this first "horror", where they basically say "it's OK to report wrong answers, because you can check the answers".

I don't think I've ever felt like it's OK for my program to provide a list of answers where some are right and some are wrong, but reading this... and generally believing in P != NP.... maybe that's a decent way of looking at some stuff!

comment 6mo ago · link · parent

Global styling done messily can override local styling. It’s the hardest kind of problem to reason about!

I do think that stuff like bootstrap is generally good at avoiding this but it only takes a handful of improperly scoped high level CSS rules to cause awkward hard-to-fix pain much later on.

comment 6mo ago · link · parent

I think it's obvious that multi terabyte repos are not the norm.

comment 6mo ago · link · parent

what are token speeds like for frontier models, if that gives a rough idea of how much "slower" slow is?

comment 6mo ago · link · parent

int d = foo ? bar() : baz();

I think if anything people have been leaning more and more into expressions over statements, because when everything is an expression you end up being able to walk the gradient of complexity a bit more nicely than when you end up with a thing that just has to be broken down to a bunch of statements.

comment 6mo ago · link · parent

So with CPython's reference counting, if you're good at not building strong cycles, you really can avoid garbage pressure. It's not even that complicated, it's mostly a question of making a weak reference _somewhere_ along the chain. Often the ergonomics are not great, but Python @property's are nice here.

So for example

class Request

class Session

request.session exists, and the session is "part" of the request. but session.request often exists as a facility. That's a reference cycle which prevents the request (and anything it's pointed at!) from being deallocated at the end of a request.

But in this case, you could easily do something like:

session._request = weakref.ref(request) # on session creation

and then have session.request call session._request() (and maybe assert session._request() is not None if you want to be certain). If you're confident that the session is a "child" of the request, and that you would _never_ have a hold of the session after the request is done, this is a cheap trick that makes session.request cost a little bit more but not much.

I think most Python libraries just don't do memory perf analyses here, and also "believe" in the garbage collector. When GC runs, both request and session will get deallocated, after all! But the long term effects of everyone relying on the GC are that GC is expensive when it doesn't need to be, and when looking through memory you just have more stuff to dig through

comment 6mo ago · link · parent

We've been chasing down similar aiohttp client creation issues (liked to ...aiobotocore usage) for months now.

It's annoying that somehow talking to S3 etc requires so much churn. We have been trying to cache session objects and the like but clearly are still missing something.

Chasing this down has also made me realize how little Python libs use `weakref`, and just will build up so many circular references. The other day I figured out Django request's session infrastructure creates a circular reference meaning that requests have to get GC'd to get cleaned up in CPython.

I have a suspicion that the 3.14 problems are heavily linked to "real" workloads being almost entirely filled with cyclical objects.

comment 6mo ago · link · parent

What kinda harness do people use with these local models? I am quite happy with the Claude Code permission model and interface in general for coding stuff (For chat-y interfaces I have no real opinion)

comment 6mo ago · link · parent

It really isn't if you don't have the right abstractions.

Especially for memory management the right and wrong abstractions in Rust can lead to a factor of 5 or 10 extra amount of difficulty. The right memory management abstraction and your code can be a straight line port (or even cleaner!), the wrong one and you're going to just be spending a lot of tokens to have a machine spin around in circles trying to untie itself

GC'd languages don't have this problem, though obviously you can still generate stupid amount of pain for yourself by doing something wrong

comment 6mo ago · link · parent

I think the big difficulty here is that Rust's ownership model in particular tends to require certain kinds of control flow to avoid a bunch of weird churning/copying, which makes it not as straightforward of a port target from other imperative languages.

Like maybe you get the LLM to try _really hard_ to churn through everything, but this feels like a big case of "perils of the lack of laziness".

Of course if you have a good idea for how to deal with allocations etc "idiomatically" already maybe that works out well. And to the credit of the port guide writer bun seems to have its explicit allocations that are already mapping pretty well to Rust.

comment 6mo ago · link · parent

Increased metadata isn't tool blunting in itself though, even if MacOS uses it for being... annoying is one way of saying it.

Provenance information bundled into a file is not the worst idea in the world IMO. We have created/modified timestamps on files already, right? There's definitely the question of "why" but hey if more of my binaries just had at least a tag about who put them there that would be a win in my book.

Not an argument for doing what MacOS does, just an argument that the info would be nice to have.

comment 6mo ago · link · parent

If airlines stopped offering flights then their loyalty programs would not be useful.

Even in this "airlines as point program companies" view of the world, flights don't make money in the same way that electricity going into data centers don't make money. It's a place where you have major costs and you want to try and gamify it, but at the end of the day it's pretty necessary for successful operations!

Consider why airline points even work as a model in the first place! Airlines have blackout dates and don't offer every seat in a plane for points because _they can make money selling a seat for more than what the points are worth to them_.

1
8910
225