HNHacker News
TopNewBestAskShowJobs

bugake

109 karma · joined September 27, 2026

submissionscomments
bugake··on Iterating Backwards in C
You should always check the compiled assembly with Compiler Explorer because compilers sometimes avoid certain optimizations for convoluted reasons, which are hard to predict.
bugake··on Iterating Backwards in C
I quote from "Optimizing Software in C++" by Agner Fog:

"Comparing an integer to zero is sometimes more efficient than comparing it to any other number. Therefore, it is slightly more efficient to make a loop count down to zero than to make it count up to some positive value, n. But not if the loop counter is used as an array index. The data cache is optimized for accessing arrays forwards, not backwards."

Yet that text was written for older CPUs. Modern CPUs are better at prefetching backwards access patterns, but if you try a microbenchmark with backwards array traversal, you may get misleading results.

bugake··on Attention people who think UB is fine
Checking-the-address is overhead.

It's like checking for overflow in an arithmetic operation. Other languages do the checking, and that's why they're slower. But C++ doesn't check because it offloads the responsibility to the coder, so the coder can write faster code if he makes sure there are no bugs.

If the coder knows there will be four return values and writes them one after the other, the return (or MOV) instructions are distanced the same. The goto hack should work.

bugake··on Perspectiva Kogui: A message on artificial intelligence from the Kogui people
This is not name-calling. It's a fact.

Falsely claiming to represent a group of people is fraud, and fraud is a crime, even if the speaker is a member of the group he claims to represent.

bugake··on H.264 Is Magic (2016)
In the end, YouTube still loses frames above 1080p, even if you have fiber-optic internet, the ultimate CPU and GPU, and loads of RAM, just because YouTube's code is garbage.
bugake··on H.264 Is Magic (2016)
Transmission cost of an interpolated frame: 0 with DLSS. But adding a little extra information could help reduce artifacts.

Sure, DLSS uses game engine information, such as motion vectors and depth, which is unavailable for video. But neural networks can estimate motion directly from video frames and interpolate without that information. Providing additional data to fix artifacts would cost little.

bugake··on H.264 Is Magic (2016)
It is time to make a standard neural network for video, which guesses the next frame and/or applies super-resolution like DLSS does, so the necessary information to transmit is reduced to the minimum necessary for DLSS to reproduce the image without loss.
bugake··on Iterating Backwards in C
For the uninformed: counting backwards in a for loop is faster because comparing an unsigned integer against 0 is generally faster than comparing it against any other value.

It also says not to use `for (i >= 0)` because any unsigned integer is >= 0, and the loop will never end.

bugake··on Perspectiva Kogui: A message on artificial intelligence from the Kogui people
This is fraud, and probably a crime.

Who gave these people the right to speak on behalf of "the Kogui people"? Nobody.

Even if the speaker were himself Kogui, he would only speak for himself. He wasn't an elected president or ambassador for the Kogui.

bugake··on If IPv4 were land
Reddit shadowbanned me multiple times for either absurd or political reasons, but my ISP used to assign dynamic IPv4 addresses, so I could easily create a new account. Then it switched to IPv6 with a static address, and now I can't create new Reddit accounts anymore.
bugake··on A new faster algorithm to compute 64-bit signed floor division
For SWAR algorithms, calculating floor(64/n) for 0 < n < 65 has always been crucial, so I spent a lot of time developing fast division algorithms. But since the Ryzen 7000 series, the fastest approach has been to simply cast 64/n to an integer.

I'm kind of sad that all those algorithms have become obsolete, but at the same time, I'm happy that integer division has finally become fast enough in hardware.

bugake··on Attention people who think UB is fine
You don't get Marssaxman's point: the problem is that "compiler authors treat undefined behavior as a license for user-hostile behavior".

Bjarne Stroustrup's criterion for language design is that C++ is an abstraction in itself over writing in assembly, and the language design should not get in the way by introducing overhead costs. C++ should allow the programmer to express their intent without losing performance relative to assembly, and it fails in this case due to undefined behavior.

So when the compiler doesn't let you implement your low-level code, it is a failure of the language and compiler relative to the design criteria of C++.

bugake··on Attention people who think UB is fine
>>I can't find the quote you're talking

Not that exact quote, but the spirit of it at 44:22.

https://youtu.be/uTxRF5ag27A?t=2662

Quote: "A zero-overhead principle. It basically says that if you have an abstraction, it should not cost anything compared to writing the equivalent code at a lower level."

bugake··on The Curse of Soldered RAM
All the wokeification posturing didn't make those companies manufacture maintainable computers for poor countries.
bugake··on The Curse of Soldered RAM
Yeah. My sister had a laptop that required a heat gun to remove its fragile keyboard, which was glued in place.
bugake··on The Curse of Soldered RAM
I have lots of family and friends who bring me their broken "thin laptops." Their thinness makes them super fragile, and they break all the time. They're also getting harder to repair as assembly becomes more convoluted each year. Even basic maintenance, like cleaning the fans, requires increasingly super difficult disassembly.

The latest models require repeatedly disassembling the sandwich from both sides. You have to remove the keyboard to access a screw, open the bottom, remove another screw to lift the top, then go back and forth between both sides just to reach a fan that frequently gets clogged with dust and needs frequent, regular cleaning.

Even worse, the unavoidable cleaning voids the warranty.

bugake··on Lula wins election after final votes tallied
Voters decided to punish themselves
bugake··on Iron Age salt-mining complex found beneath Hallstatt in Austria
Medieval German didn't have fixed rules for writing. The same word was written in different ways on the same page, so many words inherited from the Middle Ages cannot be taken literally under modern writing rules.
bugake··on The Curse of Soldered RAM
You can't buy a single LPCAMM2 RAM module on Amazon. eBay has some.
bugake··on The Curse of Soldered RAM
Prebuilt branded PCs have always had inferior quality, compatibility, and expandability problems, all with overpricing.
bugake··on The Curse of Soldered RAM
The race to make laptops thinner is pointless. I wish I could buy a thicker laptop that is more robust, repairable, expandable, and has better cooling, with the extra space filled with batteries.
bugake··on Ask HN: If the models are so good, why doesn't OpenAI just start 100 companies?
You need a reployer to start a company. These are difficult to obtain, and finding someone who knows how to use them is even harder.
bugake··on SpeedCrunch 1.1
Why do you do this when you have Pari GP?
bugake··on Bonanza of new dates rewrites the history of the Inca
The civilization found at the Inca structures was most probably descended from barbarians who conquered the civilization that built them. It's like someone arriving in Europe, finding the Franks ruling over it, and assuming they built the Roman Empire.
bugake··on Laptop Based on 6502 CPU
I always thought multiplication was one of the most basic things a CPU should handle. Weren't computers invented to perform calculations? Even a pocket calculator could multiply. I assumed CPUs handled arithmetic and not much else. I didn't even learn about bit shifts until much later, and none of the programming languages I was taught ever introduced them.
bugake··on Laptop Based on 6502 CPU
The very idea of "racing the beam" is madness distilled. How do you draw without a framebuffer and keep track of everything's position using just 128 bytes of RAM? This comment alone uses more RAM than that.
bugake··on Laptop Based on 6502 CPU
The 6502 is so primitive that it runs on an Atari equipped with 128 bytes of RAM.

Yes, 128 bytes. Used for code, data, video, and everything else.

(But it can address 64 KB)

It is so primitive that it is unable to multiply integers. If you want to multiply, you have to write your own algorithm.

bugake··on EU Defence Commissioner Kubilius: Pax Americana Is Over. ^
I can no longer read Reddit since they started enforcing logins through old.reddit links. I will not open an account.
bugake··on Woman who rescued injured crow keeps getting 'thank-you gifts' from birds [video]
I once read a theory proposing that primates got their minds from birds due to sharing trees with avians, and that viruses may have transferred genetic material horizontally from birds to primates.

It showed a chart of brain weight relative to body weight, and birds had a much higher ratio than any other animal group. Primates were on the same curve, which wasn't shared with any other mammalian group. Primates were literally on the avian curve.

But I don't remember where I saw that. I searched for it on Google and found nothing.

bugake··on I know why the mathematicians weep
Profit is the driving force behind civilization, motivating innovation and progress and allowing us to live longer and better lives instead of remaining stuck in the Stone Age.
Page 1 of 2Next →