I keep hearing this argument on HN. Yes, if performance is something you care about you totally look at the disassembly. You don’t even need to write assembly, just be able to read it. By now I assume that programmers who argue they don’t need to understand and review what the LLM generates for them are simply not that skilled and don’t realize that skilled programmers do this.
Don't post innocuous images of children ever? Seems like losing.
I do have to say that I find it disturbing how liberally parents seem to post pictures of their children in public though. Respect the privacy of your children, they’re not your pets.
I used to work for a hosting company, and all the shady business like exploitation of children and sex workers came from there unfortunately. But that’s because people move their business there for legal reasons, not because of their residents I assume.
Try to write a design doc before you implement something (which people find they need to do for LLMs to work at all anyway). You’ll find that you spend much less time actually writing code.
Write proper API documentation laying out the assumptions and intent, generate some good API docs, write a design and architecture document (which people find they need for LLMs to work at all anyway). You’ll find that you spend a lot less time reading code.
I’m sorry, but I look at this code and I can immediately see the bug? Instead of a rewind mark I personally create a local arena from the outer arena. If any allocations leak to the parent scope I put the code in a local function that takes the parent arena as a parameter. Again, if you’re so inclined you can use Rust or C++ to create smart pointers that catch this at runtime or even compile time, it’s just not a real issue for me at this point, reducing the value of complicated compiler machinery leading to bad build times.
1) An allocated memory chunk cannot outlive its arena (leaks are impossible). You probably mean a stale reference? The arena is put at such a level in the memory hierarchy that this bug becomes impossible. The bug here would be that the allocation was done in the wrong arena.
In C this would be avoided by putting temporary arenas in a local function scope by passing them as parameters. Fool proof references require C++ smart pointers. This is one example of you mixing concepts. Smart pointers/containers can still be used with arenas.
2) You mix up arenas and bump allocators. An arena can also use a pool allocator for example. Arena refers to the concept of scoping blocks of allocations.
3) Individual deallocations and arenas are not exclusive, for example using pools. But even with bump allocators free lists are a thing (and linked lists are more attractive in bump allocators because of locality).
Personally I use C or something, anything other than C++ really, if I need something more ergonomic or provably correct. Many excuse C++’s design history with “they didn’t know better”, but the oft forgotten history explained in that video shows otherwise.
Correct. But the C++ language is not a language in which one should just say “screw it” and overload the assignment operator of all things while breaking its contract. Stuff like this is why many purists argue that operator overloading shouldn’t be a thing, because it can lead to shenanigans like this.
Respectfully, you do not seem to understand this topic well. If the C++ standard library design abstracted memory allocation correctly, you’d still be able to use containers and algorithms and not even notice that their allocation strategy uses the heap, stack, a bump allocator, a pool, etc
auto_ptr was so misdesigned, they erased it from the language in a later standard.
The problem was that the assignment operator “T x = y;” is supposed to have copy semantics, but auto_ptr gave it move semantics by overwriting the source to destroy that reference. This broke all sorts of code that rightfully assumed assignment is done by copying. Therefore all kinda of algorithms like sort broke, as well as resource management. Suffice to say I am personally not a fan of C++ language design or Stroustrup’s opinions on programming.
Worse, Germany has one of the worst upward mobility stats in the EU. If you look at the filthy rich families in Germany, most of them have ties to benefitting heavily from WW2.
The tariffs put on the US by Germany were higher than the other way around in some cases, even though the US wasn’t exporting such products in any significant amount.
The C++ standard library interface is broken regarding its abstraction of allocation (according to its authors). Therefore you in fact can’t just use arenas in C++ without giving up on large parts of its standard library and becoming incompatible with other code. The languages whose users you call strange don’t have this issue.
No need to insult people just because you don’t understand other strategies for reducing the amount of lifetimes to track and consolidating deallocations by using memory arenas.
Plus the internet basically equates cynicism with intelligence
This is a generally known phenomenon in psychology. If you leave a book review saying that you liked a book, people are biased to believe you are stupid. If you criticize a book negatively people are biased to believe you are smart.
I can corroborate this. I coached mechanical engineers who had to learn some programming to conduct research by analyzing factory machine data I provided them (them being the domain experts). The ones who learned python and sql using AI hardly had learned anything after half a year, the ones I instructed where to find the API docs and a beginner tutorial weren’t just much further along, they were also on a faster trajectory for the future. I think AI is a beginner trap because it allows them to throw shit at the wall and see what sticks. It is much more useful in the hands of an expert in the long term.
I don’t think that the author considers collaboration bad in general, but instead how it’s done in most large corporations:
But there’s a huge difference between communication and collaboration as infrastructure to support individual, high-agency ownership, and communication and collaboration as the primary activity of an organisation. Which, if we’re honest, is what most collaboration-first cultures have actually built.
The compiler is often not allowed to rearrange such operations due to a change in intermediate results. So one would have to activate something like fastmath for this code, but that’s probably not desired for all code, so one has to introduce a small library, and so on. Debug builds may be using different compilation flags, and suddenly performance can become terrible while debugging. Performance can also tank because a new compiler version optimizes differently, etc. So in general I don’t think this advice is true.
The problem with Horner’s scheme is that it creates a long chain of data dependencies, instead of making full use of all execution units. Usually you’d want more of a binary tree than a chain.