3 ms·
It's deferred interpolation, which means every time.
by astrodust 9y ago
It's deferred interpolation, which means every time.
- Twirrim 9y agoOk, so very painful at scale.
- coldtea 9y agoShouldn't it be insignificant, even at scale? Heck, JS spawns functions at scale for everything, and we're worrying about mere interpolation?
- tedunangst 9y agoThe make variable interpolator may not be as optimized as the javascript function spawner.
- TheSoftwareGuy 9y agoI wouldn't be so sure about that. make has been around for several decades now, and it affects the build times of a huge number of projects. Most common versions of make have been very tightly optimized, in ways that you might not expect.
- coldtea 9y agoYeah, but it still shouldn't matter, because there's not much to optimize: string substitution is inherently fast. But it's what your sibling comment said that I missed: it might not just be string interpolation, it could bound to a shell command's result etc -- which would then be executed at every occurrence.
- khedoros1 9y agoIn this case: doesn't matter so much. Small text interpolations should be fast. In the more general case, a variable might be bound to a shell command, a huge list of files, or built-in Make functions doing a lot of work. And you might be using that variable in a thousand places. It makes sense not to repeat work that doesn't need repeated. Even more so if it could significantly slow down the build.
- astrodust 9y agoMakefiles date from an era where a 200MHz machine was fast and 32MB of memory was a lot. It's not really as painful as you think.