make simple lambda expressions inline?
I have a tendency (thanks to f # and other functional incursions) to encapsulate repeating code present in one function in lambda and call it instead. I am curious if as a result there will be overhead at runtime:
var foo = a + b; var bar = a + b;
v
Func<T1, T2> op = () => a + b; var foo = op(); var bar = op();
which one is worth more?
No. Lambda functions are not built-in, but instead are stored as delegates under the hood and carry the same execution cost as other delegates.
: . . . , , "" , , . , , , .
: , .
-, # - . jit , , # lambdas , , , . (, , , , , .)
, , . , , , , .
, , . , , , .