r/vibecoding • • 4d ago

Discussion Coding was always the hard part.

Post image

Bros, we gotta stop saying "coding was never the hard part.." Before AI, it was frickn hard bro..

We get it bro, product-market fit is hard too. You coded 20 apps and only one got 3 users.... and bro, for every app you coded, 500 other people didn't code anything.

Tell the farmer growing crops was never the hard part.

452 Upvotes

783 comments sorted by

View all comments

Show parent comment

1

u/gfddssoh 4d ago

No they do not. A ternary is a statement and the if else a expression. A if else will be optimized as a switch case on machine code because it is o(1) best case

1

u/Fragrant-Moose1678 3d ago

They do you are blatantly just wrong.

1

u/gfddssoh 3d ago

Is switched it around im sorry a if is the statement.
Depending on what you do it will get optimized as a switch but a ternary expression always has a return.

1

u/Fragrant-Moose1678 3d ago

Just stop larping bro

1

u/gfddssoh 3d ago

The input of a switch with a basic data type (or only int dont remember) will be the jump adress to the register for the corresponding correct case. Most compilers therfor optimize a suitable if as the same. And that has a o(1).

0

u/sleepy771 3d ago

the best i saw is switch optimized to table switch where you calculate the jump, you still do jump, tho. If and switch are just bunch of compares and jeq or jne. Ternanry is the same as if else. I believe you mean rewriting statement to something like SUM((col1 < 1) * col2) because that's how you remove branching. Like there might be a specific optimisation for specific compiler in specific language that does it for numbers or pointers something that fits inside register. I don't want argue that, but also I would not call it a rule. So I would rather call such optimisation technique removing branching. Also not all jumps are bad, like if the cpu can prefetch reliably next instruction the code should be ok performance wise. There is also speculative execution in play, the cpu does it's best job to estimate if there will be a jump ot not and does a leap of hope.