2 ms·
The first order function is evaluated at runtime, every time the program is executed. Macros are expanded at compile time, so they will be calculated just once.
by TuringTest 11y ago
The first order function is evaluated at runtime, every time the program is executed. Macros are expanded at compile time, so they will be calculated just once. Thus the syntactic sugar added by the macro doesn't incur a time penalty.
This can provide an important speed improvement for complex macros or code used often, in tight loops or frequently called functions (it's like using inline methods in .h files in C++).