4 ms·
A function call is not necessarily an indirection. Basic premise of the blog is wrong on its face.
by Scubabear68 7mo ago
A function call is not necessarily an indirection. Basic premise of the blog is wrong on its face.
- alilleybrinker 7mo agoDid you read the article? The author makes exactly that point.
- deleted 7mo ago[deleted]
- hrmtst93837 7mo ago[flagged]
- simonask 7mo agoWhy do you mention lifetimes here? They are exclusively a compile-time pointer annotation, they have no runtime behavior, thus no overhead. Dynamic dispatch in general is much, much faster than many people’s intuition seems to indicate. Your function doesn’t have to be going much at all for the difference to become irrelevant. Where it matters is for inlining. Dynamic dispatch in Rust is expected to be very slightly faster than in C++ (due to one fewer indirections, because Rust uses fat pointers instead of an object prefix).
- paulddraper 7mo ago1. "Indirection" can be logical, or runtime. 2. Please read the blog. That's literally what is said.