Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
nicula
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
1.
▲
Claude Code's poor time awareness
(nicula.xyz)
1 points
by
nicula
6mo ago
|
0 comments
2.
▲
Auto-vectorizing operations on buffers of unknown length
(nicula.xyz)
4 points
by
nicula
10mo ago
|
0 comments
3.
▲
by
nicula
2y ago
Yeah it's quite interesting. I don't think I've seen this come up in anything besides that talk which is about the HFT space. However, I did hear a few times about cases where you'd trade better average performance that
4.
▲
Bypassing the Branch Predictor
(nicula.xyz)
9 points
by
nicula
2y ago
|
2 comments
5.
▲
by
nicula
2y ago
Great observations, thanks! I wrote the code that you suggested (LMK if I understood your points): https://godbolt.org/z/jW4o3cnh3 And here's the benchmark output, on my machine: https://0x0.st/8Ss
6.
▲
by
nicula
2y ago
Thanks for looking into it! I modified the footnote to get rid of the misleading statements regarding the 'backfiring' of the optimization. :)
7.
▲
by
nicula
2y ago
> I'm not sure how "it can go the other way around too" -- in that case (assigning to a uint8_t local variable), it seems like that particular optimisation is just not being applied. So the case that you described has 2 la
8.
▲
by
nicula
2y ago
Some people already mentioned this in the r/cpp discussion. Small correction: 256 is not the correct number of iterations, since if all elements in that slice are even, then your 8-bit counter will wrap-around to zero, which can lead t
9.
▲
by
nicula
2y ago
Like @wffurr mentioned, this is indeed discussed in a footnote. I just added another remark to the same footnote: "It's also debatable whether or not Clang's 'optimization' results in better codegen in most cases th
10.
▲
by
nicula
2y ago
haha I didn't even notice that
11.
▲
Improving on std:count_if()'s auto-vectorization
(nicula.xyz)
134 points
by
nicula
2y ago
|
45 comments
12.
▲
by
nicula
2y ago
> So it's not a Clang regression per se, it's an issue with the LLVM core? Yes. > If you run LLVM 18's `opt` on bytecode generated by Clang 19 and then compile it, does it also generate the same bad assembly? No. If you
13.
▲
by
nicula
2y ago
This issue doesn't require large switch tables in order to show up. Even if you have 4 cases and the rest of them are default'ed, Clang 18 optimizes that to a switch, while Clang 19 does the (potentially) inefficient labels+jump
14.
▲
Getting rid of unwanted branches in C/C++ code with __builtin_unreachable()
(nicula.xyz)
2 points
by
nicula
2y ago
|
0 comments
15.
▲
by
nicula
2y ago
Oh wow didn't know about this. Somebody else posted it for me. Sorry for the dup:)
16.
▲
A Clang regression related to switch statements and inlining
(nicula.xyz)
21 points
by
nicula
2y ago
|
3 comments