DullPointer's comments

DullPointer | 3 months ago | on: You can't fool the optimizer

ARM is a big target, there could be cpus where lsl is 1 cycle and add is 2+.

Without knowing about specific compiler targets/settings this looks reasonable.

Dumb in the majority case? Absolutely, but smart on the lowest common denominator.

DullPointer | 3 months ago | on: You can't fool the optimizer

I’m not a compiler expert, an assembly expert or an ARM expert, so this may be wildly wrong, but this looks optimized to me.

The trick is that it’s doing both the add and the left shift in parallel then selecting which to use based on a compare of the two values with csel.

(To see this, rather than reading the code sequentially, think of every instruction as being issued at the same time until you hit an instruction that needs a destination register from an earlier instruction)

The add is stored in W9 but only read if the two arguments are unequal.

If the compare succeeds and the lsl retires before the add, the add is never read, so nothing stalls waiting for it and the answer can be returned while the add is still in flight. The result of the add would then be quietly discarded assuming it ever started (maybe there’s some magic where it doesn’t even happen at all?).

It’s not clear to me that this is power efficient, or that on many real cpus there’s a latency difference to exploit between add and lsl, so it may not be faster than just unconditionally doing the addition.

That said, it is definitely faster than the code as it was written which if translated to asm verbatim stalls on the compare before executing either the add or the left shift.

DullPointer | 11 months ago | on: Ask HN: How do I escape homelessness after rebuilding my mental health?

Far outside of my lived experience, but, here’s a take anyway.

Your priorities sound out of line with your current financial reality.

Concretely, you’re struggling with $890 in car costs that your current income depends on and asking how to escape homelessness. The crappy reality is that you need to maximize the safety of your one existing income stream ahead of nearly everything else. That means building up an emergency fund for car repairs.

Free cash flow, a well maintained car and a savings/emergency fund are the biggest lifelines you will be able to give yourself in the near term.

If you can get a programming job or a cheap laptop (sub $200 old Thinkpad on eBay) and start picking up some freelancing work you can do in a public library or similar, that’s amazing, but for now you’re really all in on your car and it sounds like you need to focus on that until it’s safe and stable.

Hopefully if you’re frugal, not too unlucky and do your best you’ll have more options in a few months.

This sucks and I really hope things get better for you.

DullPointer | 11 months ago | on: Stamina Is a Quiet Advantage

Fair enough. Do you think you could have taken that advice then?

Even if taking it negatively impacted loved ones (in the short term at least)?

Personally, I just don’t know how to make that kind of decision well beyond a certain point.

DullPointer | 11 months ago | on: Stamina Is a Quiet Advantage

This is good advice in general, but feels like it’s missing the point of what it’s replying to.

Concretely, it assumes a lot of agency.

The words “major life calamities and personal loss”, were key words that really change the amount of agency it’s reasonable to assume.

DullPointer | 1 year ago | on: Reinforcement Learning: An Overview

“Markov Decision Process (MDPs)” appears on the first page of the table of contents and is defined on the page indicated there.

The term is also used/linked in the fourth paragraph of the Wikipedia page for Reinforcement Learning.

It’s much more a table-stakes for talking about what problems the field tries to solve term than an exclusive preserve of the deeply immersed term.

It’s a bit like a primer on machine learning using the word “regression” casually a few times before actually defining it. Good editing practice? No. An actual road block to learning? Also no.

page 1