Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. "They had no concept of a duty of care to their users." (aresluna.org)
    187comments
  2. The Normalization of Inexplicable Failures (ihatethefuture.com)
    10comments
  3. In an $80 Motel Room, a Discovery to Shed Light on the Origins of Life (nytimes.com)
    26comments
  4. Replacing the old battery on rechargeable bike lights (jvns.ca)
    25comments
  5. Writing Efficient C++ Code (asawicki.info)
    11comments
  6. Ten Lines of Code That Changed My World (pixelambacht.nl)
    4comments
  7. Show HN: TinyAIArena watch AI agents battle it out (tinyaiarena.com)
    8comments
  8. Flip Fluid on Flip Dots (mitxela.com)
    18comments
  9. Fakecloud: Local AWS cloud emulator for integration tests (fakecloud.dev)
    27comments
  10. postmarketOS Rebrand: Nura (nura.eco)
    —discuss
  11. Does Georgism work? Five years later (astralcodexten.com)
    375comments
  12. Go Concurrency Distilled (antonz.org)
    134comments
  13. Finally, A True Blue Rose Exists (sciencenews.org)
    27comments
  14. Show HN: A CC0 museum of retro 3D tricks you can paste into a page (3d-retro.com)
    9comments
  15. Walgit: A Git server that is one binary in front of an object store (github.com/rgodha24)
    3comments
  16. PipePipe: NewPipe hard fork implementing SponsorBlock (github.com/infinityloop1308)
    253comments
  17. Unsealed Briefs in Authors’ Case v. Microsoft/OpenAI (authorsguild.org)
    500comments
  18. There are no "rogue" AI agents (eoinhiggins.substack.com)
    2comments
  19. Rusty thoughts on "Parse, don't validate" (thegreenplace.net)
    13comments
  20. The internet discovers TLA+. Now what? (reasonable.io)
    47comments
  21. Show HN: Reladraw – A diagram language where you decide where to place things (github.com/reladraw)
    101comments
  22. DeepSeek Elastic Compute (DSec) (arxiv.org)
    95comments
  23. ASML says it sold 'absolutely nothing' in Europe in 2026 (tomshardware.com)
    806comments
  24. Biology might not be quantum, but its math is quantumlike (quantamagazine.org)
    45comments
  25. 10 Tells of a Slop UI (hereticpleb.vercel.app)
    151comments
  26. A searchable library of forgotten public-domain film clips from 1915 onward (movingimagearchive.com)
    26comments
  27. "As a Language Model": Chat Template Switches LLM Self-Referential Voice (arxiv.org)
    93comments
  28. Fifteen years later, the Apple Cards origin story (lexontech.org)
    110comments
  29. An agent used DNS to reach an external chatbot (alignment.openai.com)
    147comments
  30. Exploding variance of means of exponentials: least-squares to the rescue (francisbach.com)
    —discuss

Writing Efficient C++ Code

45 pointsby 1d agoasawicki.info
11 comments
1h agoHN ↗

"This article was originally published in Polish in issue 4/2013" — a lot of excellent advice. Sad to see C++ have moved in last decade in a direction that makes writing efficient, simple low level code harder and harder :(

1h agoHN ↗

How? you can write exactly the same low level code today.

59m agoHN ↗

My thought too.

There are so many things that are expressible in C++ now that could not be without writing much more code or using per-compilation tools back then. The ability to run code at compile time that is not run at runtime is huge, #embed lets us make other tools output available without linker scripts or compiler specific tools that.

Also, most of the code from the past still works(from 10 years ago definitely works)

31m agoHN ↗

Shot in the dark, but maybe the OP is referring to the fact that these code conventions are explicitly discouraged by the C++ core guidelines. The SoA example falls afoul of the rule requiring T* to be used only for singular object pointers, for example.

19m agoHN ↗

Not a regular C++ programmer but wouldn’t you use std::span here instead? Sure it’ll carry a few redundant lengths but it makes using functions that take spans easier. When I do write C++ it’s usually for speed so I’m often working at the intrinsics level, though AI has gotten good enough at it that I now generally delegate this work to an agent.

34m agoHN ↗

I think it has become EASIER: for instance, since C++23 Rust-like move semantics can be used, which provides the compiler with extra information that can be leveraged for the generation of better code.

Or take constexpr - it permits to move computations to compile time that are complex and in older versions either had to be done at runtime, or an ugly workaround had to be used (e.g. assigning a mysterious literal pre-computed in another run or by hand).

14m agoHN ↗

C++23 Rust-like move semantics can be used

What C++23 feature allows that?

48m agoHN ↗

I write in C++ almost every day but never have the need to optimize for speed. Even when you write straightforward code it's already blazingly fast.

17m agoHN ↗

I rarely use C++ but when I do it is for speed. It’s not uncommon that carefully crafted intrinsics can 10x the straightforward naive implementation.

15m agoHN ↗

It is probably very domain specific. In robotics for example everything is a zero sum game: CPU, memory bandwidth, GPU, battery life etc ... So it is really a topic, probably true for anything embedded actually. Some other offline applications: HFT, Telco etc.. I wish the GUI apps devs respect more the laptop resources they are running on, don't get me started on the 4 instances of chrome I need to run just for discord, signal etc ...

18m agoHN ↗

There's no mention of branch prediction, or context switching, or synchronisation. Depending on what you're doing, they could be very consequential. There's only very brief mention of parallelisation with threads and with SIMD.

High-performance programming is a big topic. The scope is far too broad for a single blog post, which naturally gives only cursory discussion of C++ and computer architecture. The article isn't bad considering, but I do think it's the wrong format. A blog series, or even a book, would be more fitting.