> #define BLQS_CMP(a, b) ((a) < (b))
A function that returns true when one operand is Less Than the other, should be called BLQS_LT. The CMP abbreviation is idiomatic for a function that returns -1,0, or 1.
1,544 karma · joined August 14, 2022
> #define BLQS_CMP(a, b) ((a) < (b))
A function that returns true when one operand is Less Than the other, should be called BLQS_LT. The CMP abbreviation is idiomatic for a function that returns -1,0, or 1.
The unsaid assumption is that the array is filled with random values between 0 and 1000, so the "if" condition has a 50% of chances to be true. The branch is mispredicted 50% of times.
Of course this trick won't work when the statement protected by "if" is a more complex and costly action, or one that can't be undone (in the example, note that when the counter is not incremented, the value written to memory will be overwritten in the next cycle, so it's "undone" in a certain way).
Are you sure that windows that, without your consent, are allowed to stay on top and grab your input are a good idea? And spawned by Chrome? As if we hadn't already enough ad-ware, click-harvesters, and spoofed dialogs popping up everywhere!
I know there is a couple of legitimate uses for this, but the ways it can be abused are vastly more.
I think the sensitive default should be to block it, and allowing it should be behind some user's conscious action. Yes, it adds some friction to some workflows and it takes a bit to get accustomed to. But it doesn't deserve the label "security paranoia".
I didn't know such apps existed! What do they use it for?
Why? In the following code, only c will be allocated on the stack:
int a[]={1,2,3};
foo() {
static int b[]={1,2,3};
int c[]={1,2,3};
}What would you rather have?
How much will it take for AI agents to pass from distilling decades of collective wisdom to copying each other's worst mistakes?
By this metric, there's no need for video encoders faster than the movie's own FPS, either.
Non-fused:
foreach i
y[i] = cos(x[i])
foreach i
z[i] = cos(y[i])
Fused, no intermediate variable: foreach i
t = cos(x[i])
z[i] = cos(t)
The temporary "t" doesn't leave the GPU. Sweeping the array twice makes you twice as dependent on memory bandwidth.Probably I would have made different choices. For example, I'd rather have many modules that can be individually included, than one giant file.
Also from a purely aesthetic point of view, I would have opted for more readable function and type names: no sp_ prefix, recognizable names like dict istead of ht, vec instead of da, etc.
And I know there are compilers out there still stuck in the 90s, but I would have targeted C23, these days.
But that would be my highly opinionated library!
P.S. be aware that word frequency is not what the standard 'wc' does.
struct a {int data;};
struct b {int data;};
I know, I know, changing it would break existing code, etc.Any good book / article / tutorial to begin learning it? Most docs I've tried assume you already know what you can do and focus on how to express it in assembly or with intrinsics. However, I'm not even aware of what operations are commonly implemented in hardware. For example, FMA is not normally tought, is not expressed in higher-level languages... how am I supposed to imagine such a thing exists, even before looking it up in a reference manual?
> That's not what the author said.
It is exactly what the author said. TFA makes a point that Windows' issues are well known and predictable. And the author would rather endure the daily nuisances infliced by Windows than fix the sporadic breakages that Linux might throw.
LLMs spit out a sequence of tokens that is the most probable continuation of the input. LLMs don't lie any more than technical analysis does when it predicts the most likely trend of stock prices. It's up to you how to use this information.
A better strategy would be to first search the given range for the first empty slot, and exclude everything after that point. Then proceed looking for tophash in the thus-limited interval. The return value has 3 possible values: 1) key found, 2) reached end of interval without finding but it might be in the other half, 3) found an empty slot so the key is not present, not even in the second half.
There's more to Linux than the kernel.
Is it considered good pactice to publish a vulnerability not yet patched in any stable branch?
1. Put them always in the same place. Especially the "back" or "exit" button!
2. Each button should do one thing, not switch between 3 or more modes that you should look to understand which one you've just activated. Negative example: one button to cycle from cuise control, to drive assist, to speed limit, and back to off.
3. The area where a tap is interpreted as a button press should not also be where a swipe is recognized. In moving vehicles it is too easy for your finger to swing just an inch before touching the screen.
4. The active area of a virtual button must be large, larger than the icon it displays, so large that you shouldn't be distracted from driving just to aim at it!
Honestly I don't see much difference between
upb_MiniTable_FindFieldByNumber
and upb::MiniTable::FindFieldByNumber> The popular Roaring Bitmap format uses arrays of 16-bit integers of size ranging from 1 to 4096. We sometimes have to check whether a value is present.
There's no claim that this algorithm is universal and performs equally well for other problems.
In fact, note how the compare operation on the data types involved (16-bit integers) is quite cheap for modern CPUs. A similar problem with strings instead of integers would get no benefits from the author's ideas and would actually fare worse, due to useless comparisons per cycle.
Are you sure OP belongs in the second group? He explicitly said he doesn't read all the code generated by his AI:
> I have not read most of the code, and instead focused on results, so you might say this was “vibe-coded.”