HNHacker News
TopNewBestAskShowJobs

garfieldandthe

30 karma · joined June 10, 2023

submissionscomments
garfieldandthe··on Myths Programmers Believe about CPU Caches (2018)
> Would you rather handle 1000 request per second or 1?

Would you rather like to approach this problem by optimizing memory layout which, let's be honest, tends to give you more in the region of 1-10% improvements rather than 10-100x, or would you rather like to try to go from O(n^3) to O(n^2) or O(n log n) or similar?

The real meat is in the complexity class. Cache effects are where you go when there is nothing else to optimize and it actually matters. Preemptively making all your data structures 2-3 as big because of not-actually-necessary padding does not sound right to me, but YMMV.

garfieldandthe··on Myths Programmers Believe about CPU Caches (2018)
Maybe you shouldn't be doing O(n^2) inside a request handler in the first place. This has nothing to do with caches.

And even if you do quadratic operations in your handler, how often do you write a new such handler? Most of the time you work on stuff around that, supporting infra, testing, etc. None of those needs to be cache optimized either.

garfieldandthe··on Myths Programmers Believe about CPU Caches (2018)
How many of your structs does your code access million times a second? For most programs, that number is firmly 0.

While you are optimizing your struct layout and decrease you app start time from 1.122765 seconds to 1.122764 seconds, I ship production code at 2x the rate because I only optimize for performance where it matters while otherwise optimizing for maintainability, testability, extensibility, dev fun and actually shipping.

garfieldandthe··on Myths Programmers Believe about CPU Caches (2018)
> Sometimes you have some very very high-use variables, with multiple threads each having one and writing to it often.

And how often do you actually write such code? Most people: Between rarely and never. You write single threaded code or use synchronization primitives. Sure if you are writing a library squeezing performance out of some parallel processing problem then this is relevant, but that's a niche scenario.

> The fix there is absolutely trivial: add padding.

Most common case is that this just wastes memory. Don't micro-optimizr before you know that this is actually a problem.

> Another often-trivial one is avoiding linked lists whenever feasible.

Again, not true, depending on your use case. If the operations that you commonly perform on the data structure, like inserting/deleting elements, then of course you should use a linked list or whatever container data structure your language provides. How caches play into this is at most a second order effect in the common case, unless you really want to optimize a tight loop in a performance critical application.

I've seen too many prematurely applied fancy data structures where it turned out that all this extra complexity was entirely unnecessary and just made things harder to maintain.

garfieldandthe··on Myths Programmers Believe about CPU Caches (2018)
The central myth is that the average programmer should care.

The typical programmer should treat CPU caches as what they are designed to be: mostly transparent. You work in a high level language and leave the tricky details to a library and your compiler.

It's only a small minority that should really worry about these things.

In my daily work, I see more often premature microoptimizations (in part using the myths from the article) which are entirely unnecessary rather than code that needs to optimize for those things.

garfieldandthe··on Video-Based Cryptanalysis
This is insane:

> We demonstrate the application of video-based cryptanalysis by performing two side-channel cryptanalytic timing attacks and recover: (1) a 256- bit ECDSA key from a smart card by analyzing video footage of the power LED of a smart card reader via a hijacked Internet-connected security camera located 16 meters away from the smart card reader, and (2) a 378-bit SIKE key from a Samsung Galaxy S8 by analyzing video footage of the power LED of Logitech Z120 USB speakers that were connected to the same USB hub (that was used to charge the Galaxy S8) via an iPhone 13 Pro Max.

Had this been in a movie, you'd say it's unrealistic and the filmmakers have no clue how technology works.

garfieldandthe··on The Reddit blackout will continue
Honest question since I don't really know how reddit works: Why can't reddit just forcefully re-open the subs that have been taken private? Mods are using powers given to them by the platform and I don't get why they are not being stripped of (some of) those powers.
garfieldandthe··on A new experiment casts doubt on the leading theory of the nucleus
> We have a long way to go before we can par ourselves on the back and claim to truly understand what’s going on.

This is a misconception of scientific endeavour in general and of physics in particular. All models are approximations of reality. We have a theory that is consistent with experimental observations, then we make observations with which the theory is not consistent anymore and we develop a new theory that explains those new observations as well, and so on. We will never have an "exact" model, whatever that even means. But we have models that have limitations that are far beyond what's relevant for most people's life.

At many points in time, we could pat ourselves on the back. The heliocentric model. Newtons model. General Relativity. The Standard Model. All these models were important steps forward and led us to where we are today, which is absolutely astonishing. No, we don't have a full theory explaining everything, but we never will.

garfieldandthe··on Xerox scanners randomly alter numbers in scanned documents (2013)
The youtube link is David presenting his work that he describes in the originally linked article. One of the legendary presentations in CCC's history.
garfieldandthe··on Bad waitress: Dying on your feet
"Hard working" and "smart" are very different things.

One could almost say that not being smart requires you to be harder working. (At least that's what I'm telling myself to keep working hard.)

garfieldandthe··on Chat Notebooks
Elon dropped out of openai because of differences regarding direction and conflicts with what Tesla is doing. He then secretly started developing sth similar and asked for a.moratorium on research+dev so his secret thing can catch up.
garfieldandthe··on Chat Notebooks
First sentence he claims he invented sth a long time back, but it definitely has prior art.

I stopped reading right there. If everybody did that then perhaps he'd learn to be able to express things without immediately being full of himself.