|
|
|
|
|
by caconym_
3459 days ago
|
|
> Many rust advocates talk about the performance cost of doing things safely in C Who's saying this? It doesn't really make sense, taken out of context as it is here. > inform me that rust has "Zero-cost abstractions" IMO at best the array bounds checking thing is an extremely poor example of a "zero-cost abstraction"; at worst it's not an example of it at all. As I understand it, the term refers to things like static dispatch on closures and trait methods, iterator fusion, and generally any place where the compiler can transform high level abstractions into really efficient low-level code where in other languages/implementations you might incur a performance penalty, for instance by dynamic dispatch to heap-allocated closures, or allocation of an intermediate vector at every "link" in an iterator method chain. |
|