Comptime is certainly nice but not usable in this context I’m afraid.
Also I’ve heard that argument a ton. It’s total complete rubbish as far as I’m concerned. Extrapolating, if you see a function call, what really can you say about the “cost” of that function? To me, without actual investigation, the answer is zilch. The function might be inlined, in the i-cache, referencing a lazily loaded symbol. It might be a small function, it might be huge, it may flush the cache, idk. If the goal was to be able to estimate the performance at a glance, well, we should use assembly, and even then the performance isn’t always clear.
Also I’ve heard that argument a ton. It’s total complete rubbish as far as I’m concerned. Extrapolating, if you see a function call, what really can you say about the “cost” of that function? To me, without actual investigation, the answer is zilch. The function might be inlined, in the i-cache, referencing a lazily loaded symbol. It might be a small function, it might be huge, it may flush the cache, idk. If the goal was to be able to estimate the performance at a glance, well, we should use assembly, and even then the performance isn’t always clear.