Yet another way to say it would be to say that "zero cost abstractions" are often "zero cost" in the same way that watching a movie on Netflix is "zero cost". It's only "zero cost" if you don't count the $15/mo subscription fee, the fact that the selection is limited, etc.
-
-
Replying to @cmuratori @Jonathan_Blow and
That analogy makes sense to me. Indeed, in C++, "zero cost" usually means "you couldn't have written better C++ by hand", not "you couldn't have written better assembly by hand".
1 reply 0 retweets 0 likes -
Replying to @BatmanAoD @Jonathan_Blow and
Again, just to be clear, _you could_ have written better C++ by hand. That was the point of the monomorphization - what the compiler generates is not as good as if you have manually written what you wanted, because you can make better "commonization" tradeoffs.
1 reply 0 retweets 0 likes -
Replying to @cmuratori @BatmanAoD and
"Zero cost" is literally just false. It's not true that it's zero cost over C++, and it's not true that it's zero cost over asm. It's just plain wrong. Things should just be called abstractions, never "zero cost" abstractions because they aren't, and that's that.
2 replies 1 retweet 2 likes -
Replying to @cmuratori @Jonathan_Blow and
That's an extremely interesting claim. I have no idea how to evaluate it, though; would you recommend just comparing the assembly generated by template-heavy code to some hand-written code doing the same thing? Do you have an example of a specific resource you could point me to?
1 reply 0 retweets 0 likes -
Replying to @BatmanAoD @Jonathan_Blow and
Not to beat a dead horse, but evaluating my claim that there _aren't_ "zero cost abstractions" is also approaching the problem the wrong way around. Shouldn't the goal be to evaluate the _original_ claim that there _are_ zero cost abstractions?
1 reply 1 retweet 8 likes -
Replying to @cmuratori @BatmanAoD and
One thing you will notice if you look at it, is that basically nobody who claims to provide a "zero cost abstraction" ever offers any proof that it is. They just say something like "and the compiler can do it" and that's it. But where is the evidence? Where are the case studies?
1 reply 1 retweet 6 likes -
Replying to @cmuratori @BatmanAoD and
The onus shouldn't be on people to prove that something _isn't_ "zero cost", it should be on the people claiming it's "zero cost" to prove that it _is_, right? And that proof is nowhere to be found.
1 reply 0 retweets 8 likes -
Replying to @cmuratori @BatmanAoD and
And it's worth noting that the original claim is _very_ bold. They're not called "low cost abstractions", they're called "_zero_ cost abstractions". A claim that something is literally free should require a high level of proof. Yet it's quite the opposite.
3 replies 1 retweet 6 likes -
Replying to @cmuratori @Jonathan_Blow and
Kyle J Strand Retweeted Kyle J Strand
Well, again, it was never intended to mean "literally free"; and, yes, it's a terrible term. But there are some abstractions that _are_ free; for instance, without exception support, Rust's `Box` can result in exactly the same code as a raw pointer:https://twitter.com/BatmanAoD/status/1235750716334960640 …
Kyle J Strand added,
2 replies 0 retweets 0 likes
I'm going to tune out of this discussion now, but again, no one is arguing that abstractions don't _sometimes_ result in the optimal code. The point is they don't _always_ result in the optimal code. The fact that Rust occasionally produces the right thing is irrelevant.
-
-
Replying to @cmuratori @Jonathan_Blow and
My impression of Jonathan's original argument was (at least in part) that lambdas cannot produce optimal code compared to macros. He provided Carruth's talk as evidence that zero-cost abstractions _don't exist_.
1 reply 0 retweets 2 likes -
This Tweet is unavailable.
- Show replies
New conversation -
-
-
Replying to @cmuratori @BatmanAoD and
I'm sorry to drag this up, bit I was under the impression that requilting unquilted formats was always optimal and always zero-cost. Maybe I'm wrong, or maybe this doesn't apply since `git` isn't a language... But, for sure, programming The Variable is provably zero-cost.
0 replies 0 retweets 0 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.