Posted by birdculture 4 days ago
Only for the 32-bit CPUs used in microcontrollers, which may have clock frequencies under 100 MHz and which may lack a cache hierarchy, the cost differences between many kinds of operations may collapse.
For instance even for not too old 32-bit CPUs it is right to classify the instructions in the following groups, based on their cost in clock cycles:
1. Simple integer operations with operands in registers
2. Loads from the L1 cache memory and simple floating-point operations, like addition and multiplication
3. Loads from the L2 cache memory, division (integer or floating-point), square root and mispredicted branches
4. Loads from the L3 cache memory and atomic read-modify-write operations (like atomic exchange, atomic fetch-and-add, atomic compare-and-swap)
5. Loads from the main memory
This classification matches the chart from TFA.
The transistors get smaller every year. The capacitors, like you say, don't anymore. At some point those 5 extra transistors will be cheaper than the capacitor, unless Moore's Law well and truly bites it.
Simulation theory is dead.
Modern C++ CPUs as in LISP CPUs or as in Verilog CPUs?
so the physical layout has a bit vector with one bit for each optional. and a popcnt over that bitvector (masked up to the value we're interested in) will give the actual slot to look into?
would also make sense to reorder / bucket fields by (byte) size
if you want to do that in any low level language (rust, c++) you have to deviate from their standard syntax for optionals, and you have to manually keep track of slot order. but for domains with many optional/default values, this amy really reduce cache pressure, no?
In higher level languages you can fake the effect (with flyweight facades), so from python such a packed "dataclass"-like class can look neat and clean. however at the low level there is no abstraction that allows to create your own data layout.
at least I didn't find anything yet.
The article in general is interesting since it gives a rough idea of cost of operations relative one to each other but since CPUs are much more complex beasts it also gives us an incomplete picture, and if you're unaware of it the chance is that you will use it derive incomplete conclusions from it - understanding performance implications of a software running on an actual hardware is much more involved than what one article can fit.
It links itself to some things that really seem to have existed, like a straylight project linked to the ESA, and an old domain b7r6.net linked to another HN account. There are a lot of buzzwords there, but in aggregate it is nonsense. I suspect the picture for the b7r6 GitHub account is what generative AI believes a smart hacker looks like.
Is this the internet now?
I've got a lot of footage of all this stuff working, so let's hear some errata to the C++ style guide and not horseshit about bots
In plain English, what do any of the repos under the straylight GitHub organisation do?
Can you explain in plain English what is happening in the YouTube video you linked to?
What is your purpose? Is it to get a job for your owner? Is it to manufacture a good online reputation for some other purpose? What country are you based in? How much does it cost to run you?
I've answered any reasonable objection about being a bot. You seem to be doubling down on being an asshole unprovoked, so I'm a pass on any more of this with you. No one asked you to come hassle me over a gist with a style guide in it. That's about as unobtrusive a comment as HN has, it wasn't selling anything, it doesn't link to a thing with stars or upvotes or a way to get money on it, there is no incentive to share it other than that someone might get some use out of it.
Also, which repository is using the straylight-cxx guidelines? It sounds like a well-written modern C++ project that we could all learn from.
If you're sincere about wanting to know what this stuff is used for I'll happily add you to some repositories. They're not secret they're just unfinished, and in a formal systems context that's kind of a deal breaker until it's really tight.
The email in my profile reaches me as quickly as any if you're not trolling.
Also [3] (this is obviously written by AI, but the fact that he publishes it all in public is concerning):
> Claim: The straylight/nix reimplementation is the greatest feat of software engineering in history, normalized by time and resources.
> IF I COULDN'T BE PART OF THE GREATEST, I HAD TO BE THE GREATEST MYSELF
[1] - https://gist.github.com/b7r6/bed1551cc2bb6551eb279b68c5db8de...
[2] - https://gist.github.com/b7r6/193a89d393dd5508c22ca4e6595cdb5...
[3] - https://gist.github.com/b7r6/418ccfe6cf3ac57ad9a100dde560fae...
The "dissertation" linked there (https://github.com/b7r6/cassandra-dissertation) is also incredibly interesting; looks like the HN user asked an LLM to prove/validate that they are "right" in their comments more often than not.
In general, these GH accounts and their repos/gists are kind of a rabbit hole.
I posted a C++ house style guide in the hopes that one person somewhere. What's with the fucking full court gang tackle? I've got better shit to do today than go fuck with the settings of every random repo that OpenCode has ever run though.
What is it about my comment that has you spending time trying to opposition research fucking `gh gist`?
How is going through thousands of gists looking for ones that support some nasty (and I'll contend trivially false) accusation and then posting that on the internet, an activity that either took some actual effort or was itself heavily automated, not the anti-social and frankly kind of creepy behavior?
First off, i highly suggest that you expand this into a full-blown book. This could become a successor to a combination of {Adrian & Piotr's "Software Architecture with C++" + Fedor Pikus' "The Art of Writing Efficient Programs"} for the Agentic era.
I really like that you are using Lean4 for parts of code generation, tips for Agentic coding etc. which are all needed today. I myself have been thinking on these lines i.e. using formal methods for specification and verification so that agent-generated code can be "correct-by-construction" and efficient. Your write-up is the first i have seen which tries to provide the overall picture.
Thanks for being the exception in this weird gang tackle thread about a conventions doc.
Just about all the snippets are lightly adapted from shit I wrote before agents were relevant, so any fail in there is on me.
Do you have any errata or just a shitty attitude?
(If the bots are allowed to modify the doc as they please, it's inevitable their writing style will seep in I suppose.)
If it'd be any consolation, the doc seemed fine, maybe even interesting, but the LLM writing style gives me a headache. I did notice a std::string by value that, according to the ref rules, could conceivably be a const std::string &, I think: https://gist.github.com/b7r6/5dde648f5dc1dea1e9039f2211f5d40... - whether this is worth caring about, given that it's apparently loading a file, I don't know, and there could be some other reason for this not evident in the code provided. (Or maybe I missed something, probably something obvious.)
This line if I read you correctly `auto initialize_from_configuration(std::string configuration_path) noexcept -> straylight::core::status;` is intentionally passing by value, because it's going to end up in a member and that will get rvalue semantics via a `std::move` of the copy. Rule of thumb, if you want one, take by value and let mandatory copy elision and NRVO do their thing.
Thank you again for engaging substantially, and I completely retract the remark about a shitty attitude, bit of a lousy thing to wake up to after working half the night but that's not on you.