HNHacker News
TopNewBestAskShowJobs

derf_

2,790 karma · joined July 22, 2012

submissionscomments
derf_··on A new faster algorithm to compute 64-bit signed floor division
I love to see this kind of optimization, of course, but there are other cases where Robison division is great, just because it has basically the same form for every divisor:

1. The divisor is not actually a compile-time constant, but comes from a small set. You can compute a table of corresponding constants and use the same code for every divisor.

2. You want to do many divisions by many different divisors (whether known at compile-time or drawn from a small set, like above, or pre-computable and applied many times... think of something like a quantization matrix for image coding, for example). Here Robison easily SIMDifies, whereas an algorithm that needs different code paths for every divisor is going to be much more difficult.

Regarding the lack of native signed-unsigned multiplies, as someone who does a lot of multimedia processing, I find the set of available multiplication instructions on x86 and ARM to be rather shamefully limited (especially x86). I recall a colleague who used to optimize for VideoCore (the GPU in a Raspberry Pi) saying that when he first started he was astounded that it had 80 different multiply instructions, but within a year or two he had used basically all of them.

derf_··on Microsoft offers voluntary buyouts to a quarter of its workforce
I would also add: anyone who started 4...5 years ago. These people received options grants as the market was in its 2022 slump. Since then the stock is up 1.5x...2.4x (depending on exactly when they received their grant), and those grants are reaching the end of their vest. Yes, there are refresher grants, but realistically these employees' total compensation is about to drop off a cliff, if it hasn't already.

That is not the kind of thing that inspires a person to stick around.

derf_··on Your C is not standard C
From the beginning of Section 3.3 (several pages before the text you quoted in Section 3.3.7):

      Some operators (the unary operator ~ , and the binary operators << ,
  >> , & , ^ , and | , collectively described as bitwise operators)
  shall have operands that have integral type.  These operators return
  values that depend on the internal representations of integers, and
  thus have implementation-defined aspects for signed types.
derf_··on Your C is not standard C
> Previously, in C89, left shift on signed integers was completely undefined...

No, it was implementation defined, which is very different. Every implementation you were ever likely to encounter defined it reasonably. Making some of it undefined now has created a bunch of code that uses macros to cast back and forth between unsigned to get the expected behavior (or, for cases where it is provable that the result is representable, to replace the left shift with a multiplication and hope the optimizing compiler translates it back, because compilers now warn on any left shift of a negative value, despite the fact that the semantics are supposed to be the same as the corresponding multiplication now).

In other words, it created a mess for basically no reason.

derf_··on I would like the value of my home to rise, while my property taxes fall
> That sounds like shifting the property tax burden from homeowners to renters...

This is all obviously very specific to the locality where you live, but at least where I live, property values were recently reassessed to account for the large post-pandemic increases. Individual homeowners were generally stuck with these reassessments, while commercial properties, especially those managed by large property management groups, were organized and successfully petitioned to reduce those assessments in disproportionate numbers. So the balance of power was not equal to start with.

derf_··on 10-year Treasury yield climbs above 5.3% to a level not seen in 24 years
I don't think it's correct to say "rates were kept low" as if the Fed had a choice in the matter. All the Fed can really do is respond to market conditions. It can be slow to react, and it could in theory be wrong about the market in a way that causes economic damage (in one direction or the other), but it can't really do better than the implied market rate.

Interest rates were kept at historic lows for a decade because the 2008 crisis caused available credit to absolutely implode, which destroyed a huge swath of the effective money supply. Leverage ratios at banks went from north of 40:1 to closer to 10:1. Without ZIRP and QE and all of the rest, we would have had outright deflation, kicking off the kind of deflationary debt spiral that made the Great Depression so bad.

That kind of dramatic destruction of credit did not happen during the pandemic. The banks were fine [0]. What happened was that the economic output of actual goods and services collapsed. So high levels of stimulus led to more money chasing fewer real resources, and you got inflation instead.

This should not have been a surprise.

[0] Modulo a few like SVB that blew up a couple of years later because they had forgotten that interest rates could also go up.

derf_··on The senior engineer death spiral
This is fine advice up to a certain point, but you do not accomplish bigger and grander things by working harder, nor even, as this implies, by working more diligently. You accomplish them through leverage.

It is not just about what you are working on. You need to understand what everyone else is working on, and more importantly, what they could be working on (their capabilities) and what they should be working on (the org's priorities). When you find yourself being dragged in to meetings to write roadmaps, estimate schedules, and contribute paragraphs to the annual budgeting process, you know you're on the right track.

He does have one thing right, that this is about reputation, because you cannot just go out and unilaterally take this authority. It has to be earned. Having a large number of lines of code written, commits landed, and tickets closed can be a means to that end, but it is not in and of itself the goal.

derf_··on Global bond yields hit 2008 highs, raising stakes for big borrowers
No, that risk always existed. When the Communists took over Russia, they did not bother to honor all of the Tsarist debts. A country is not like a company. Sovereign default is always a choice. That is what it means to be sovereign.

There have been over 70 incidents of overt domestic default since 1800. The United States defaulted in 1790, when a portion of the interest it owed was deferred for 10 years, and technically defaulted again in 1933 when it abrogated the gold clause.

derf_··on The case against JPEG XL
You're welcome. That is what those image sets were for.

I was really happy Thomas Davies added quantization matrices to the spec, because if he hadn't, I would have had to. Fortunately, he did a good job. I am glad someone is finally using them. Don't sleep on per-segment quantizer deltas, either.

derf_··on The case against JPEG XL
There were something like 40 companies involved in AV1 standardization. Quite a few technical contributions did not come from Google, and quite a few of Google's proposals were substantially modified by feedback from others before they were included (and not all of them were eventually included).

Source: I lead Mozilla's technical contributions to AV1.

derf_··on The case against JPEG XL
> A lower resolution image layered below the full resolution image, which is loaded and rendered first.

Unlike a thumbnail, higher-resolution layers can be predicted from the lower-resolution layer, so those bits are not wasted. That is not possible by layering <img> elements.

derf_··on LG denies TV spying claims, says tracking and snooping concerns 'not true'
I don't need the TV to be cheaper. I can afford to make up the difference for whatever few hundred dollars extra they would earn selling my data. But the expensive ones do this stuff, too.
derf_··on Visualizing Rust's Vtables: How dyn Trait Works In Memory
My first question was, if the vtable only has a single function in it (as in these examples), can the compiler optimize it to a function pointer to save an indirection?
derf_··on The Real Luxuries In Life
To steel-man their argument, I think what they are trying to describe is https://en.wikipedia.org/wiki/Anxious-preoccupied_attachment vs. https://en.wikipedia.org/wiki/Secure_attachment
derf_··on Global Trade and the United States Navy
Sarah C. M. Paine has an excellent series of lectures on what it means to be a "continental" vs. a "maritime" power, and how the latter build wealth through trade and an international rules-based order. https://www.youtube.com/watch?v=u9VSg4ZSwJs is probably the most succinct, and a good introduction if the name Alfred T. Mahan is not familiar to you. Dwarkesh Patel's channel has a more recent 9-part series (on this and other topics): https://www.youtube.com/@DwarkeshPatel
derf_··on Stopping the smart TV from being used against you
Warren Buffett has often said, "In looking for people to hire, you look for three qualities: integrity, intelligence, and energy. And if you don't have the first, the other two will kill you."

The exact same logic applies to devices you buy. These companies have shown they do not have any integrity. So why would you want buy something from them that is "smart" and never sleeps?

derf_··on The Tariff Cost: analysis of the costs to Americans from new tariffs on Canada
It all comes down to who has pricing power. If Canadian exporters can raise prices without unduly harming sales, then the tariffs on their goods are predominantly paid by American consumers. If the US cannot, then the tariffs on their goods are predominantly paid by American exporters (and must be absorbed by reducing profit margins).

Whether or not that is true, I have no idea. One would expect there to be enough diversity of trade that on the balance it cannot be that lopsided, but maybe that's wrong. It is certainly possible for one side of a trade war to be hurt both coming and going, without any logical inconsistency.

derf_··on And then the men with guns tell you to do it anyway
"Aware" is definitely one choice of word. The expectation in Seoul is that if the day ever does come, you will be dead before you make it out of the office building you work in. They run evacuation drills anyway, because of course they do.
derf_··on Memory prices climb 500% in 12 months
> The component category I've never seen fail is CPU.

The CPU can fail if the heatsink falls off! That is something that happens (I've had one come off in my hand that was being held on by nothing but hopes and dreams, fortunately not while the CPU was powered on). More likely in a desktop tower form factor.

derf_··on SIMD in the 90s: Programming Intel's Pentium MMX
> I believe that only the first Pentium 3 core, Katmai, did this.

No, the Pentium M (Banias / Dothan) also needed multiple cycles for basic SSE2 ops (with a few exceptions like PUNPCKLQDQ or PMOVMSKB), a full four years after Katmai (source: I owned one, and wrote SIMD on it for codec libraries).

derf_··on Secondhand book sales are booming. Is it because of AI?
My preferred book format is also the mass-market paperback, which the current publishing industry has decided should no longer exist, probably because they found they could not charge over $20 for them.

I can also find decades' worth of quality books for prices that sometimes drop below $1 (though popular / rare books are frequently sold for more than their original asking price now, but inflation-adjusted, that is still a good deal, and much less than a new book). There is no reason to expect that just because something was just published recently that it is worth many multiples the cost of an older book. I will still buy new books to support authors I particularly like, but as prices keep going up, I find I am becoming more and more selective.

And finally, physical books do not spy on me or show me ads, or otherwise try to coerce me into an abusive relationship, like every other form of entertainment seems to attempt to do these days.

derf_··on Every exterior shot in The Taking of Pelham 123
Hopscotch (1980) is another great Walter Matthau movie. He is just having fun the whole time.
derf_··on Mini retirements: like a sabbatical, but much smaller
You also have 60 days from when your coverage ends to elect to enroll in COBRA, and for many plans coverage is retroactive to when your original coverage ended (although you have to pay premiums retroactively, too). That gives you close to 3 months between intentional job changes where there is health insurance available if you need it, but you do not have to pay for it if you do not need it.
derf_··on AI Companies Are Trying to Hide a Staggering Amount of Debt
> When these fail, it will become everyone's problem.

Debt is senior to equity. For private credit to start taking haircuts, the equity has to have already gone to zero. At that point, this will already have been everyone's problem for some time.

derf_··on Everyone should know SIMD
To bolster the argument, even if you do not plan to write the SIMD yourself or will "just get AI to do it", it is important to know what can be fast in SIMD (and on what hardware). That allows you to design your algorithms and structure your code so that the SIMD is possible.

Internalizing things like how data dependencies matter, how expensive it is to increase the width of your vector elements (and how to avoid the need), how to turn conditions and branches into masks, or simply things like "division does not exist" becomes a lot easier when you have spent at least some time trying to use SIMD yourself.

derf_··on Show HN: misa77 - a codec that decodes 2x faster than LZ4 (at better ratios)
I used the same "separate stream" design (one of them coded backwards from the end, to eliminate the need to send a separate offset) when working on video compression, to separate out arithmetic-coded bits from literal bits. It's a good idea. The only reason it isn't in AV1 is because hardware wanted to do DRM decryption in order.
derf_··on Berkshire's $397B Bet Against an Overheated Market
> ...doesn’t that depend on infinite growth based ultimately on mostly finite natural resources, manpower, and land?

There is no practical limit to the price of the index. Shares may represent some claim on those things you mentioned, but shares outstanding have been steadily shrinking for decades, essentially since the dot-com boom [0]. Meanwhile, governments have been printing money like it's going out of style, and most of it has been ending up with the wealthy, who, lacking any practical way to spend it all on consumption, use it to bid up asset prices. It is no wonder that the price of a shrinking pool of actual resources [1] has risen dramatically when measured in a growing supply of money (which is only a relative resource, not a real one).

One could certainly look at the rise of the 401k as a retirement vehicle, and conclude that at some point those flows are going to reverse. One could also look at the US SSA statistics on the number of workers per retiree, and its trend over time, and paint a pretty grim picture, but is that enough to offset the combined forces of inflation and the compounding wealth of the ultra-wealthy?

Man, I don't know, either.

The good news is "nothing" is all you need to know to invest in an index fund.

[0] This has actually reversed recently with the AI boom, but it is the first time in a while that companies have tried harder to raise capital to grow the pie than to buy back shares to return cash to shareholders.

[1] Rather, a shrinking pool of claims on those resources, each claim increasing its value measured in real resources as companies buy back shares, an effect Buffett famously loves.

derf_··on Every new car sold in the European Union must include a driver monitoring camera
I drove an '89 Prelude (with a carburetor!) that had been used hard before I acquired it, until it left me stranded by the side of the road one too many times. I am happy to report that a 2000 Acura Integra is a very reasonable upgrade. Basically the same car, except better (fuel injection, ABS brakes, airbags, etc.). The only thing I miss is that the Prelude had a tighter turning radius.
derf_··on FFmpeg 9.1's new AAC encoder
At one point in I think 2012 three of us who normally all live in different countries were riding in the same car in Australia. We advised the driver to be extra careful (she was dating one of us, so incentives were aligned).

But it is nice to hear that you have been thinking of us, too.

derf_··on Nintendo has raised its employees base salary by 10%
A steady amount of inflation allows interest rates to be near zero or even negative in real terms without actually being negative in nominal terms. Negative (real) interest rates are sometimes a necessary policy tool (see: 2008...2021), but negative nominal rates are difficult to implement in practice in our current regime of privately-controlled money creation via bank lending.

There are other monetary schemes that allow for negative nominal rates (100% reserve-backed lending, a.k.a. The Chicago Plan, or the gold or silver standard, etc.), and in those one does not need steady inflation. There was basically no inflation for most of the 19th century, when most currencies were backed by gold or silver. That had other drawbacks: for example, a relative inability to control the money supply. An expanding money supply following the California gold rush helped fuel speculation during the railroad boom, and the inability to expand the money supply on demand exacerbated the ensuing panic of 1873. Governments at the time did not believe it was their job to dampen the impacts of the business cycle, however.

Page 1 of 17Next →