Better HN
topnewbestaskshowjobs
Log inSign up

mattnewport

3,559 karma · joined Nov 24, 2011 (15y ago) · 856 submissions

Cofounder / CTO at Osso VR.
Submissions

comment 7mo ago · link · parent

Ironic that they used an LLM to write the article:

> 42.9 units of insulin from a single photo. That’s not a rounding error. That’s a potential fatality.

comment 7mo ago · link · parent

It's ironic that the STL basically exists for stable sort (that's what Alex Stepanov was trying to create an efficient version of which led to most of the standard algorithms as building blocks), yet it's apparently not had much optimization focus in this standard library implementation.

comment 8mo ago · link · parent

I think a better approach might be automated performance regression tests. That's checking the property you probably actually care about directly (performance) and leaves the compiler (and other engineers) some leeway to do better without breaking the test.

Actually setting up a robust system for perf regression tests is tricky though...

comment 10mo ago · link · parent

The disconnect is weird isn't it? The latest coding models can churn out a lot of mediocre code that more or less works if the task is sufficiently well specified, but it's not particularly good code, they have no real taste, no instinct for elegance or simplification, weak high level design. It's useful, but not anywhere near superhuman. It's also my impression that improvements in raw intelligence, far from increasing exponentially, are plateauing. The advances that people are excited about come from agentic patterns and tool use, but it's not much higher levels of intelligence, just slightly better intelligence run in a loop with feedback. Again that's useful but it's nowhere in the realms of "greater than Nobel winning across all domains".

Outside of coding, the top models still fall flat on their face when faced with relatively simple knowledge work. I got completely bogus info on a fairly simple tax question just a few days ago for example, and anyone using AI regularly with any discernment runs into simple failures like this all the time. It's still useful but the idea that we're on some trajectory to exceeding top human performance across all domains seems completely unrealistic when I look at my experience of how things have actually been progressing.

comment 10mo ago · link · parent

Yeah, you can even use tree-sitter to implement a language server, I've done this for a custom scripting language we use at work.

comment 11mo ago · link · parent

Good article, thanks!

Minor correction though, I think this is not quite correct:

> The compiler computes the required size at compile time by summing the sizes of all locals (accounting for alignment).

In optimized C++ builds, compilers can reuse stack storage for locals whose live ranges don’t overlap, so the required stack frame size is not necessarily the sum of all locals. Some locals may never have stack storage at all (e.g. living entirely in registers or being optimized away).

For objects with non-trivial destructors, storage reuse is constrained by object lifetime and destruction semantics, but the same stack slot may still be reused after the destructor has run.

comment 12mo ago · link · parent

That's not really "fooling" the optimizer, that's kind of the point of volatile. The optimizer not making optimizations is the intended behaviour.

comment 1y ago · link · parent

This might be true in the abstract but it's not true of actual compilers dealing with real world calling conventions. Absent inlining or whole program optimization, calling conventions across translation units don't leave much room for flexibility.

The semantics of pass by const reference are also not exactly the same as pass by value in C++. The compiler can't in general assume a const reference doesn't alias other arguments or global variables and so has to be more conservative with certain optimizations than with pass by value.

comment 1y ago · link · parent

> Are there any debuggers that let you look at intermediate results of pipelines without modifying the code?

F# in the visual studio debugger does a pretty good job of this in recent versions.

comment 1y ago · link · parent

What's the basis for your claim that it is on an exponential growth trajectory? That's not the way it feels to me as a fairly heavy user, it feels more like an asymptotic approach to expert human level performance where each new model gets a bit closer but is not yet reaching it, at least in areas where I am expert enough to judge. Improvements since the original ChatGPT don't feel exponential to me.

comment 1y ago · link · parent

Big little cores like on mobile or some Intel processors are really not the same thing. The little cores have the same instruction set and address the same memory as the big cores and are pretty transparent to devs apart from some different performance characteristics.

The SPEs were a different instruction set with a different compiler tool chain running separate binaries. You didn't have access to an OS or much of a standard library, you only had 256K of memory shared between code and data. You had to set up DMA transfers to access data from main memory. There was no concept of memory protection so you could easily stomp over code with a write to a bad pointer (addressing wrapped so any pointer value including 0 was valid to write to). Most systems would have to be more or less completely rewritten to take advantage of them.

comment 1y ago · link · parent

UI is also a sync problem if you squint a bit. React like systems are an attempt to be a sync engine between model and view in a sense.

Multiplayer games too.

comment 2y ago · link · parent

- Sum types / discriminated unions

- Pattern matching (arguably a more flexible and general way to do the type of thing you have in your number 4 if syntax)

comment 2y ago · link · parent

I use Zola, a static site generator written in Rust, and Github pages for hosting on my own domain.

comment 2y ago · link · parent

Medical Nemesis by Ivan Illich

comment 2y ago · link · parent

This looks cool, I find myself wishing for a language and introductory tutorial that isn't so targeted at Python programmes however (though I understand from a commercial point of view why that may make sense).

It seems like this is actually an elegant typed functional language but the Python syntax looks ugly and verbose and like it's trying to hide that compared to something more ML/F# or Haskell inspired.

I'll try and get past that though as it does look like there's something pretty interesting here.

comment 2y ago · link · parent

Modules, standardised in C++20, are the official solution both for the standard library and for other code but they are not universally well supported by all major compilers and build systems yet.

Transitioning existing code to use modules is also not entirely straightforward, though probably no more problematic than introducing unity builds.

comment 2y ago · link · parent

This is true but in practice it's pretty common to find this sort of code seems to work fine on x64 because the compiler doesn't actually reorder things and then sometimes blows up on ARM (or PowerPC, though that's less commonly encountered in the wild these days).

comment 2y ago · link · parent

Ok, that's not really what your example showed though. You seem to be relying on string interning to have two different "hello" literals refer to the same underlying object and therefore be equal? Coming from other languages, and specifically C++, I tend to see `==` as value rather than reference equality so that wasn't immediately obvious to me.

The equivalent code in C++ has different semantics but a function that takes a non const reference in C++ cannot change what the reference refers to (references are immutable in that sense in C++, they can only ever refer to one object). What a non const reference allows in C++ is for the called function to change the value of the object referred to and since strings are not immutable in C++ that means that the value of string s could change, not the object identity.

With pointers to pointers, or references to pointers in C++ you can further change the object pointed to / referred to but not with references (there's no such thing as a reference to a reference in C++).

comment 2y ago · link · parent

That's only because strings are immutable in Java. It's not true for reference types in general.

In C++ passing a pointer by value is effectively the same as passing a reference, the only real difference being that the syntax for accessing the underlying value is more implicit for a reference.

comment 2y ago · link · parent

Yeah, this is one of those things that while it may be more technically correct causes a lot of unnecessary confusion. I remember being confused by this as a C++ programmer learning Java when resources claimed that Java was always pass by value where the actual behaviour in almost all cases (due to Java going almost all-in on objects) is what a C++ programmer would expect from pass by reference.

I still see even relatively experienced programmers who don't understand this, particularly working with Unity where a lot of programmers came from C++ to C# and don't realise for example that a C# function that takes a List 'by value' and modifies it is actually modifying the same instance that was passed in by the caller.

comment 2y ago · link · parent

That's not really accurate. Component based systems are designed specifically to address situations that traditional inheritance doesn't handle well.

Examples are usually something like having a base entity, a player that inherits from entity and an enemy that inherits from entity. Then you have a magic user and a barbarian inherit from enemy but now you also want your player to be able to use magic. Traditional OOP doesn't make it easy to share the implementation.

Even with composition and interfaces you still have problems with most traditional OOP languages when you want to do things like change the set of components of an entity dynamically at runtime (player gains or loses the ability to use magic during the game).

"Is a" is often not the relationship you want to model. A player and an NPC both have the "has a" relationship to an inventory, not the "is a" for example.

comment 2y ago · link · parent

Not really, the data oriented design movement in games programming that eschews OOP is driven by performance concerns of traditional OOP code on areas like rendering.

As a graphics programmer for many years I can also say that OOP is not really a good fit design wise for modern rendering engines, it mostly just gets in the way.

comment 2y ago · link · parent

Inheritance doesn't work well for games, that's why so many games take a component based approach like Unity, or full blown ECS.

comment 2y ago · link · parent

The use case is for dedicated game servers controlled by the developer running in data centers, not clients running on player's home computers.

comment 2y ago · link · parent

At least for depression, the chemical imbalance theory has long been disproved, a recent summary of the evidence: https://www.theguardian.com/society/2022/jul/20/scientists-q...

comment 3y ago · link · parent

Anyone saying "I need you to..." just makes me think of Bill Lumbergh from Office Space. Doesn't come across well at all.

comment 3y ago · link · parent

Have you looked at F#? If you like the MLish aspects of Rust but want to not have to deal with some of the manual memory management complexity it's pretty nice. There's access to the whole .NET ecosystem too, as well as really good tooling and IDE support, though not all .NET libraries written in / for C# feel totally natural to consume from F#.

comment 3y ago · link · parent

Sounds like Azure Durable Functions: https://learn.microsoft.com/en-us/azure/azure-functions/dura...

comment 3y ago · link · parent

Doesn't really explain Rotherham.
12345
29