Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
simonask
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
7 ms
·
121.
▲
by
simonask
5mo ago
Every vectorized string search algorithm (including those treating an unsigned long as a "vector" of 8 bytes) currently needs a prelude that performs the search up to the first alignment boundary, and then performs the bulk of the
122.
▲
by
simonask
5mo ago
You didn’t really say that, but feel free to share any reasons you might have to think so. I don’t see any reason why it wouldn’t be perfectly fine on recent hardware, where unaligned loads are just as fast, and the cache pressure is identi
123.
▲
by
simonask
5mo ago
> In the C ecosystem, the compiler gets to define what UB means. It really doesn't though. The current revision of the ISO/IEC 9899 standards document gets to define it, nobody else.
124.
▲
by
simonask
5mo ago
If you're aware of that technique, why were you asking about use cases for unaligned loads?
125.
▲
by
simonask
5mo ago
> Assuming by "grown-ups" you mean Team Blue I am deeply, profoundly, emphatically uninterested in your "teams". Your local news are not relevant to us. What the rest of the world sees is US foreign policy, and the m
126.
▲
by
simonask
5mo ago
Strings typically consist of UTF-8 bytes, and any old `char*` pair has no alignment guarantees.
127.
▲
by
simonask
5mo ago
String search algorithms would be one example, where a 64-bit register can be used as a “vector” containing 8x1 bytes.
128.
▲
by
simonask
5mo ago
Who cares at this point. Nothing has ever managed to unite Europeans as effectively as the orange man’s unrelenting torrent of temper tantrums over the past year and a half. Americans, we know some of you aren’t crazy. Can’t wait for the gr
129.
▲
by
simonask
5mo ago
I don’t think any of that is justification for making unaligned access UB. It’s reason to avoid it or discourage it in certain scenarios, but it’s infinitesimally rare that loading 8 bytes instead of 4 is even measurable, and that includes
130.
▲
by
simonask
5mo ago
Also, it’s been way more than a decade since Pentium 4 was remotely relevant.
131.
▲
by
simonask
5mo ago
Well, Zig is aiming to be a "saner C", and mostly succeeding so far. I hope they make it to production. Rust is a somewhat more thorough attempt to actually course-correct.
132.
▲
by
simonask
5mo ago
It's not flexible in practice, because knowing the standard isn't optional. If you make the choice to not follow the standard, you're making the choice to write fundamentally broken software. Sometimes with catastrophic conse
133.
▲
by
simonask
5mo ago
The point I'm getting at is that your definition of "simple" (a word that should be banned among programmers) is not useful, if it is even meaningful. The brainfuck example is "simpler": Only 8 kinds of tokens! Not
134.
▲
by
simonask
5mo ago
> just That word is carrying a lot of weight here. Compilers are unbelievably complex these days, and it's impossible for any one human to fully understand the entire compilation process, including the effects of any arbitrary combi
135.
▲
by
simonask
5mo ago
Sure, but the point is that code written against such a compiler is not C and is not portable. It is written in a dialect of C, and that comes with drawbacks. Writing C (or any language) means adhering to the standard, because that's t
136.
▲
by
simonask
5mo ago
Excuse me, what? I was writing both C and C++ 20 years ago, and UB was a huge part of the conversation (and the curriculum) back then as well. There were a few high-profile "scandals" around GCC 3.2 (IIRC) because the compiler fin
137.
▲
by
simonask
5mo ago
If they do, that is no longer an implementation of C. It is a dialect of C, and there are many (GNU C being the most popular), but there are real drawbacks to using dialects. This is in contrast to the other category that exists, which is &
138.
▲
by
simonask
5mo ago
Zig is cool, but it is not even close to being ready for prime-time. It will be pre-1.0 for a while, and major breaking changes are still happening.
139.
▲
by
simonask
5mo ago
Many, many programmers come to C (and C++) with a lower-level understanding that actually gets in the way here. They understand that all types "are" just bytes and that all pointers "are" just register-sized integer addr
140.
▲
by
simonask
5mo ago
Intuitively yes - the program will be compiled as if B-inputs are never passed to the program, and that can include eliminating code that tries to detect B-inputs.
141.
▲
by
simonask
5mo ago
C is not a simple language in the sense that writing software in C is simple, and I think that's the only useful way to understand the word "simple" in this context. Brainfuck is "simple" by any other definition as
142.
▲
by
simonask
5mo ago
Deterministic, well-defined behavior is inherently safer than undefined behavior. It allows you to diagnose the problem and fix it. UB emphatically does not, and I don't dare to think of how many millions of person-hours are wasted eve
143.
▲
by
simonask
5mo ago
I think the article's point is that you don't actually have to get weird at all to run into UB. Lots of people mistakenly think that C and C++ are "really flexible" because they let you do "what you want". The
144.
▲
by
simonask
5mo ago
Capitalism cannot produce good software, just like it cannot produce good art, or children.
145.
▲
by
simonask
5mo ago
"Linux" doesn't need to do anything here. What's missing is for anticheat vendors to develop kernel modules for Linux in addition to their Windows drivers. I personally hope they never do, because present day anticheat s
146.
▲
by
simonask
5mo ago
The problem with Windows isn’t the kernel, which is generally reported to be actually quite excellent. The problem is everything else.
147.
▲
by
simonask
5mo ago
Not the person you replied to, but I think the point is that it isn’t really that interesting to point out that you can achieve certain things in Python with enough diligence. Practical experience shows that languages that force some strict
148.
▲
by
simonask
5mo ago
Thanks, that’s interesting. It feels like a sensible choice.
149.
▲
by
simonask
5mo ago
Anything with a good, static type system will be an improvement, in my opinion. Types exist to encode invariants in an enforceable way, after all. Rust is the gold standard among imperative languages, but it’s standard fare among functional
150.
▲
by
simonask
5mo ago
Python is locally readable. Reasoning about larger systems in Python is where things get really hard, because you have to describe how many small individually readable things interact with each other in a very limited vocabulary.
More ›