skysight-inc/HackerNews huggingface dataset:
> surely neither version guarantees that the generated code is branchless, it's all still up to the compiler.

That is true, and the article mentions that GCC did not want to generate branchless code in this case, and thus performed much worse. Only Clang reliably generated the branchless code, and thus Clang was used for all of the benchmarking.

> the compiler was also free to turn the original 'if/then' structure into branchless code using conditional instructions

If we were just talking about:

if (*it < pivot) p++;

then I would agree with you. Optimizing this into the branchless version is a relatively trivial operation:

p += (*it < pivot);

However the actual code was:

if (*it < pivot) {
std::swap(*it, *p); // Could be a self-swap
p++;
}

This std::swap() line performs two memory reads and a memory write, but only if the condition is true. Eliminating the branch in this case will cause these memory operations to happen unconditionally, which means the optimizer will actually be introducing extra memory operations. This is the opposite of what you generally expect an optimizer to do: if anything you usually want an optimizer to reduce the number of memory operations being performed! The compiler would need to be extremely confident that this will somehow speed up the program overall, and it will also need to guarantee that none of these new loads/stores can possibly introduce memory errors (out-of-bounds reads or writes).

For these reasons, I don't expect real compilers to ever translate the example above into the equivalent branchless code, as given in Andrei's article:

auto x = *read;
auto smaller = -int(x < pivot);
auto delta = smaller & (read - first);
first[delta] = *first;
read[-delta] = x;
first -= smaller;
Drugstores in the US are a general store for the most part. They carry many things, but they are usually priced higher than a regular supermarket for convenience.

You can buy food, drinks, condoms, makeup, medicine, photos, and other things. It's a good business because most people need something to do while they wait on the pharmacist so they can purchase anything they need while waiting.
Did anybody poll Americans on Trump's promise to only nominate federal and SCOTUS judges from the Federalist Society's list?

No? Why not?
Back in the era when some businesses were still racially segregated, would it be noble to vote with your feet against a business that chose to desegregate?
There are many different kinds of insulins at different prices, and apparently, in the US there is not though political will to pay for any choice of them as even the federal government restricts which one it pays for.

https://www.healthline.com/diabetesmine/new-medicare-program...
> so pointers seemed "obvious"

Indeed - having come from low level route, never really understood why people get so confused with them
People always dismissed people complaining that a minority got picked over them to look good in the company photo.

Well, here is that process in plain sight.
No, you don't save any energy by connecting them.
Yes, that’s why I called out submissiveness not Japanese women.

Japan is far from the only country that extolls the virtues of submissiveness. But this was my first time experiencing the implications of that in person and it creeped me out.
The benefit of rail is that you exchange the enormous capex of shaping and planting metal rails for only having to run and maintain a single locomotive that pulls simple boxes with wheels that can move staggering amounts of tonnage efficiently.

This system requires both building more infrastructure to leverage the granularity of the cars, more infrastructure to keep a massive fleet of batteries charged, and more maintenance as each freight car now has a drive system.

If this already existed someone would pitch leveraging the economies of scale where you'd build a huge car that pulls all the other ones and you only need to keep 1 battery charged... which is what we have right now...
I remember a time when Netflix held a contest to see who could come up with the best recommendation system. They even shared a large database so people could experiment on it.

Nowadays I feel those streaming services keep trying to push onto you what they want you to watch.

They keep recommending the same videos over and over in different categories
Google’s going off Topics again
> and then you live in an out-of-the-way town with few ways to resell

Why do we always buy/update our house for the next owner?
Of course updates need to be consecutively applied, but we don't have to force them on the user when they're released. We also don't have to force unrelated updates when they only want an update for one specific package (dependencies forgiving, of course)

Is this not how things are managed on basically every Linux distro?

That's just concerning OS updates but it sounds like you're asking about a piece of software that is something entirely different. From my understanding, a good practice is to have all minor updates be compatible and only break that on a new major release. So don't make evey update a major release, doing that is actively hostile to users.
>basic infrastructure and diverse local culture

Or, you know, a job.
Same in the US. They still process photos but they mail them now. The turn-around is usually a week or two.
"simply Google search would have showed them the way"

That is how high toxicity systems get made.
https://thehill.com/regulation/court-battles/360598-meet-the...
I think that the premise here is correct - writing unsafe Rust is too hard. There are lots of footguns.

This isn't a very good motivating example but I suppose it does the job of showing the various hoops one has to jump through when using unsafe.

I think right now the approach is to make unsafe "safe" (ie std::mem::uninitialized -> MaybeUninit) at the cost of complex, and eventually to build out improved helpers and abstractions. Obviously this is still ongoing.

But also, just don't write unsafe? It's very easy to avoid.
Totally agree. Electronics has never been easier thanks to low-cost microcontrollers like the ESP32. Most of the "electronics" you'll be doing is simply plumbing--connecting the GPIO outputs of your microcontroller to whatever peripherals you want to support. It's a good gateway into the wider world of electronics.
Ask HN: Resources for learning about the web and websites
If I wanted to start from absolute scratch learning about how the web and websites function, as if it were the early 90s and work up to the present, what resources do you got for me? I wanna relearn everything, and see where I end up (hopefully outside corporate hegemkny). I wanna learn every basic, 101, "what is a server," "how to build a website from nothing," "what is a computer," etc.

Got any resources for me?
Don't forget sales/marketing overpromisers and nosy executives who get in the developers' hair.
Not as long as they have a good understanding of what's involved, and can ask questions leading you to deliver better value to business.
I <3 Scala a great deal. Wrote it professionally for years and did just as you suggest; set rules about what patterns were acceptable and not. Regardless, the common critique against Scala is that of an impenetrable haven for type astronauts, such as the Admiral Ackbar operator.
> Some sort of analogy could be margin calls/puts.

That is not a comparable situation. The ETH/WETH trader misused a negotiable instrument, and 500K disappeared forever. Someone who loses 500K gambling on margin was gambling and lost. If they somehow mistakenly placed an order on margin, there's probably a process to reverse the transaction and get your funds returned within a specific time window (that's just a guess on my part, though, and it probably depends on the brokerage used).

> It's very hard to draw parallels from cryptocurrencies to other things as it's not like other things we have today.

I don't think this is true; cryptocurrency in this situation is very similar to cash. You can get mugged while holding 500K in a briefcase, and the funds are unrecoverable absent legal restitution. But that's why banks make you sign a waiver of liability when you withdraw large sums in cash.
In the US, “drugstores” are also historically neighborhood stores: they contain both a pharmacy and a convenience section. It’s not common anymore, but many drugstores also had lunch counters.

I’m not exactly sure why that was the case, but convenience is a plausible reason: you need to be there to pick up your medicine, so why not get your photos developed at the same time?
Nit:
Send me to the US version of Amazon if I'm from the US.
Colleges and universities across the US are moving to ban caste discrimination
I agree. I don't think the person who wrote that is advocating depopulation either. Just pointing out to anyone who might advocate it that it will take too long anyway.
It's the correct answer.

You still sometimes need it like:

- when highly optimizing some algorithms

- doing FFI

So places you find it include some aync runtimes, some algorithm libraries, the standard library.

Still often times you initialize it by fully writing it, not by writing fields.

Anyway rules are simple:

1. use `ptr::write` instead of `ptr =`

2. use `addr_of_mut!(ptr.x)` instead of `&ptr.x` to get field pointers

3. uhm, `packed` structs are a mess, if you have some you need to take a lot of additional care, this is not limited to rust but also true for C/C++

Also you do not need `#[repr(C)]`, while the rust-specification is pending and as such `repr(Rust)` is pretty much undefined you still can expect fields to be aligned (as else you would have unaligned-`&` which is quite a problem and would likely cause a bunch of breakage through the eco-system).
> Where should one go to learn how all of these systems work?

Here's the path I'd suggest:

1) If you have no basic understanding of blockchains, read Satoshi's Bitcoin original paper, and Ethereum's Yellow paper.

2) Read about ERC-20 [1][2], to understand what "tokens" really are (TLDR: basically a hashtable stored in the ethereum blockchain, containing a mapping of balances to addresses, and the expectation that you must implement a standard API to be considered an ERC-20 token)

3) Learn about Solidity. The language is dead simple if you have any programming background (preferable C, but not too different than Rust/Python/Go), although it takes some time to wrap your head around the idea that the state is stored permanently in the blockchain. There's plenty of tutorials, but I found Ivan on Tech [3] to be excellent, and Moralis Academy [4] if you want something more structured (plus they offer many other courses in this area).

Solidity documentation [5] is also excellent. And Remix IDE [6] makes it really easy to experiment and run your "hello world" solidity programs in a simulated environment, without worrying about deploying to testnet, faucets, etc.

[1] https://ethereum.org/en/developers/docs/standards/tokens/erc...

[2] https://www.investopedia.com/news/what-erc20-and-what-does-i...

[3] https://www.youtube.com/watch?v=ILw-7mplRlI&list=PLo0ddf4DBU...

[4] https://academy.moralis.io/

[5] https://docs.soliditylang.org/en/v0.8.11/

[6] https://remix.ethereum.org/
Any married people have advice on how to track finances? I used bean count or ledger when i was single, but the manual system kind of breaks down when you have a family .
In Canada private health clinics can not legally provide care that is covered by the Canada Health Act.

EDIT: After further reading it appears that private health care is a murky area in some provinces. My above stated belief appears to be wrong at least in terms of how things actually work there. Here is my view. Private medical care should be banned.
Nobody is being negatively affected by this ban. I learned plenty about the holocaust without having it delivered in graphic novel form.
Well, if you read something like the The Californian Ideology now, with our current ability at retrospection, you can pose that in the 90s and aughts, there was a widescale capture of the "hippie" hacker class (as the essay puts it) by capital, where businesses had to adjust there strategies to properly utilize the then desperately needed class of artisans. Silicon valley culture is the dialectical result of this endeavor.

Combine that with the simple (and I think understandable at the time) belief in a cyber-tinted technological determinism, along with billions of dollars worth of investors, and its easy to see what we have now: at best, full-tilt neoliberal rationalism, and at worst, libertarianism.
Hmm. Maybe it’s regional? I spent years of my life finding all the best pancakes and French Toast of Auckland cafes and they all (at least aspired) to be thick and fluffy- unless they were intentionally crepes which are also very common.

The outlier I remember being when McDonalds started doing breakfast and they offered pancakes - I think I got them once when I had a super early flight at the airport and they were almost inedible- thin and rubbery! Easily the worst pancakes I’ve had in my life.
That is supposedly the goal of high deductible health plans and HSAs.
If it's a "Dutch baby" pancake, they're baked in frying pan. But they only thing Dutch about them is the name. They are, in fact, an American invention.
One thing I didn't see mentioned are taxes. Kansas has both relatively high side income and property taxes. Building a modest house(200k) on a good income (150k) would yield something around 12k a year in taxes, if my mental heavily rounding math is right.

That may not sound like much to many of us, but compare that with say, TN, where you'd pay closer to 2k in taxes AND have much better weather, amenities, and scenery.
It's not problematic, it's just not work that's been done yet. Rust isn't finished. I bet you could get an RFC pushed through and implement it if you wanted to, it certainly is a promising idea.
If you want to try an alternative to Jester, Prologue is very nice to use: https://github.com/planety/prologue
Yeah, but the web was instantly useful for a huge array of legitimate uses.

It was never a solution in search of a problem.

In 1999 the tech wasn't there but everyone could see where it was going, like all investments, it was a matter of timing.

Crypto is still at the fundamental research phase and we don't even have consensus that it does more good than bad, yet.
> I am using Hugo,2 a static website generator, to generate, well, static HTML files.

Many people think it's a binary option of handwriting HTML vs using WordPress, but with a static site generator you get the advantage of both. I think static site generator are still exiting technology. Also companies are still sending Word-files to each other, while you are using git, and the web to publish, so you are still 30 years ahead of the rest - who are trying to get ahead by taking short-cuts like jumping on the latest hype train.
> The irony to me is they are just too old to know about all the rap songs glorifying drinking lean during an opioid epidemic. Not even misinformation about lean, actively promoting.

Or they think misinformation is worse. Or they think Spotify hand picking Rogan's show to fund and promote came with responsibility just distribution doesn't.
Use More 1-1-1s
Exactly this. I'm not sure what the author's practical goal is with that code. He rejects #[repr(C)] a few times, so it's not FFI.

Yes, working with uninitialized memory is tedious. But that isn't something you ever have to do. If you're translating some C to Rust, write it using Rust idioms, instead of trying to preserve every call to malloc/free and every access to uninitialized memory.
You have a point, but there are also second-order effects of letting fraud run wild.
How to Do Two Sided Printing on a Single Sided Printer (2001)
Most developing places here (NYC) charge the same for B&W and C-41; E-6 is definitely costlier (and harder to find).
Thanks for the feedback, working on fixing it!

As for the first question: it depends on which country do you target, essentially on each site you can filter to find remote roles and some roles that offer Visa Sponsorship (which is important in case you would like to move to Europe)
Many Americans never leave the country because the US is already pretty vast. Put Texas on a map of Europe and traveling mostly straight (with some slight detours) from the north tip to the south tip can take you through the Netherlands, Belgium, Luxemburg, France, Germany, Switzerland, and Italy[1].

There's also oceans or large distances separating it from most other countries so going anywhere besides the Caribbean islands or Canada/Mexico is going to require an often not very cheap plane flight (probably $400/person at a minimum, likely more, and roughly 2.5x that if you're wanting to go to Asia/Australia).

Also, only about 37% of Americans have passports[2], and you can go on cruises without a passport (and used to be able to go to Canada/Mexico without one, but that's changed in the last decade), and the process can take 2-3 months and $165 in fees by itself (I just checked, I'm one of those people that still haven't gotten a passport yet...would have if the pandemic didn't happen in 2020, we were planning a trip to Canada that year), so that's a bit of a deterrent as well.

[1]: https://www.texasmonthly.com/the-daily-post/how-big-is-texas...
[2]: https://today.yougov.com/topics/travel/articles-reports/2021...
You can read https://en.wikipedia.org/wiki/Indian_Territory_in_the_Americ... for more information, but yes, several of the tribes in the Indian Territory did in fact make alliances with the Confederacy and fought on the side of the Confederacy against the Union.
They probably would because of the analytic/continental divide, but that's fine. That doesn't mean they're right.

Thousand Plateaus was extremely poetic but its contents can be converted into more straightforward ideas like deterritorialisation and schizoanalysis. Poetry is just the delivery mechanism.

Also Deleuze is an example of a philosopher who has both done poetic and analytic work (including metaphysics, which is a core analytic discipline) but is generally considered a continental philosopher. I don't think the distinction matters - both "sides" just explore different philosophical topics. I enjoy both of them and the divide seems petty.
Reminded me of this area teaching computers to argue[0].

[0]: https://en.wikipedia.org/wiki/Argumentation_framework
If siding with scientists against those who spread misinformation is considered anti American, then what's the definition of American? You are offending your own country.
>decent pizza place, it’s spinach, Stilton, bacon, and red potato. Possibly with broccoli or a vodka base, if I’m in the mood.

This sounds like the type of pizza common on the west coast, maybe California in particular? Possibly other parts of the world, but I'm less familiar with regional pizza varieties outside the US. In a traditional Italian pizzeria on the east coast those are simply not part of the regional variety. "Stilton" would get you a strange look. "red potato" would probably be met with "we can put fries on it". Bacon is very common. Broccoli and vodka sauce are a lot less common, but I see the options sometimes. A plain pie (crust, mozzarella, red tomato sauce) is the most common though maybe about tied with the most common topping, pepperoni. "Detroit" pizza is seen as an abomination by many pizza afficionados on the east coast, west coast, and Chicago, but I'm no pizza snob, and have been looking for the opportunity to try it, but have only seen the option from one of the big 3 chains and they're.never the same as the authentic regional varieties.
Not sure on all of them, but many sided with them in exchange for recognition of their own entities.

https://en.wikipedia.org/wiki/Native_Americans_in_the_Americ...
Which guy? Assuming you mean Lofgren or Young, their decision to move on from Spotify as not to consort with misinformation peddling is nothing more than another expression of freedom of speech and choice. Sounds like you're for one side being able to express and not the other. Also, they're not saying Spotify doesn't have a right to roll with Rogan, in fact they're explicitly saying they have every right to do so. Freedom of speech doesn't protect you from your neighborhood telling you you're an asshole.
I have a wife, i don't have a homelab.
It feels really disingenuous to put all of the blame on consumers that are motivated to find the best price for basic goods like food instead of the companies that operate at the scale which enables them to undercut local business to lethal degree. You're essentially arguing that consumers are at fault for acting the way that the consumer-driven capitalist business model expects them to behave. Major investment in cheap, nationwide retail caused this, not consumers.
Having acquired C++ into my toolbox in 1993, and thus lived through its adoption over C (which still owns several domains after 50 years), I am bettting that Rust at 30 years of age into production will suffer similar fate.
On closing a contract a new one is needed, unlike boycott.
I probably don't live in the same part of the world as you. IBAN account numbers are not common here at all.
As integers are "movable" (moving them in C++ just copies them, but you can call std::move), implementations of algorithms like std::sort tend to assume they are only allowed to move things.

You could in principle write two implementations, one that moves + swaps, and one that moves, swaps and (occasionally if it really wants to) copies, but it's extremely hard (possibly impossible) to decide when it is "safe" to use the std::sort that can copy.

It turns out it is much easier to optimise if you can copy the pivot into a local variable, but that's hard to do in std::sort.
Can you even really blame the consumers? That's like blaming the birds who eat at bird feeders instead of the people who put out bird feeders in cities [1]. Blame the corporations and builders.

[1] Bird feeders can contribute to the decline of native plants when birds who disperse the seeds in their scat feed at the feeders, their scat often lands somewhere where the seeds have no chance at germinating (sidewalk, mowed lawn etc)
While it's true that individual consumers make choices like this, it's not fair to blame individuals for systemic problems. If a person making a low wage is given the choice between feeling good about supporting local business, and being able to afford enough food to survive by shopping at a big box store, it's not really a fair choice.
Nice read. Firm supporter of Web Pi (3.1415). When it comes to building for the web today, I'm always amazed that "so much can be done with so little" and yet the default is the opposite - "so much is needed to deliver so little" - so irrational! Where did we go wrong? I wonder what Web Euler (2.71828) would have looked like?
Really the op should ask if learning c will make him better at leetcode. That’s really the metric all programming salaries are judged by it seems
We have a different approach: we require each company to publish salary brackets - which was not the case for StackOverflow - it was voluntary there.
I agree with the first part -- I implemented the movable std::sort for g++, and I found it very hard to convince the compiler to keep the pivot in a register (although I did write it over 10 years ago, maybe the compiler would do a better job by now!)
Are you suggesting that Young is attention-seeking for financial gain?

He's already pretty wealthy, he loses money by leaving Spotify, and he's a muso, not a politico - people buy his records because they like the music, not because they admire his opinions.
There have been a few 'magic machines' for developing film over the last few years, but they are not cheap. i.e. the Filmomat[1] costs 4K Euros.

There are also some simpler products that just make the process a little easier, like the Lab Box[2] which basically just offers an easier way to load the film onto the spool. Developing B&W film with this type of machine is pretty easy and the chemicals are cheap.

[1] https://www.filmomat.eu/

[2] https://www.lab-box.it/