for (long i = 2; i <= rounds + 2; i++) {
x *= -1.0;
pi += x / (2.0 * i - 1.0);
}
With my older version of Clang, the resulting assembly at -O3 isn't vectorized. Now look at the C version in leibniz.c: rounds += 2u; // do this outside the loop
for (unsigned i=2u; i < rounds; ++i) // use ++i instead of i++
{
double x = -1.0 + 2.0 * (i & 0x1); // allows vectorization
pi += (x / (2u * i - 1u)); // double / unsigned = double
}
This produces vectorized code when I compile it. When I replace the Objective C loop with that code, the compiler also produces vectorized code.You see something similar in the other kings-of-speed languages. Zig? It's the C code ported directly to a different syntax. D? Exact same. Fortran 90? Slightly different, but still obviously written with compiler vectorization in mind.
(For what it's worth, the trunk version of Clang is able to auto-vectorize either version of the loop without help.)
It's true this is a microbenchmark and not super informative about "Big Problems" (because nothing is). But it absolutely shows up code generation and interpretation performance in an interesting way.
Note in particular the huge delta between rust 1.92 and nightly. I'm gonna guess that's down to the autovectorizer having a hole that the implementation slipped through, and they fixed it.
https://github.com/niklas-heer/speed-comparison/blob/master/...
https://github.com/niklas-heer/speed-comparison/blob/master/...
The idea of a House of Lords does strike me as a bit odd, but it's not really the big deal it used to be.
They’re providing worldwide rural broadband, and according to the FAA they’re doing so in a way that’s careful and responsible about space debris and collision avoidance. Is disgust truly warranted in this case?
>Don’t waste their time with “Great party.” Say something more vivid. “The lighting is perfect.”
What? I think someone needing this level of instruction would be better served by basic mindfulness and small, manageable exercises in active listening or empathetic dialog, rather than a grab bag of non-contextual tips like this.
(On a slightly funny personal note, the thing that helped me most with social skills was watching the first few seasons of Buffy the Vampire Slayer in my first year of college. The actors emoted so clearly that even I could understand what feelings they were trying to convey, and that’s how I learned to do body language and appropriate vocal tones. This took me from unapproachable to merely awkward, a huge step up in the world.)
Expecting rational thought to correspond to reality is like expecting a 6 million line program written in a hypothetical programming language invented in the 1700s to run bug free on a turing machine.
Tooling matters.
(You didn’t explicitly say otherwise, so if my exasperation is misdirected then you have my apology in advance.)
Memory-mapped I/O can be great in some circumstances, but a one-time read of a small file is one of the canonical examples for when it isn't worth the hassle and setup/teardown overhead.