[EMAIL PROTECTED] sed in <[EMAIL PROTECTED]>: >> %% <[EMAIL PROTECTED]> writes: >> >> >>> any other special character that would cause make to kick the command to >> >>> the slow path? >> >> k> BTW Solaris /bin/test is a shellscript which is merly `basename $0` >> k> "$@" so on platforms like this, the slow path (sh -c test) should >> k> be faster. >> >> Why faster? This means make invokes a shell, which invokes a shell, >> which invokes basename.
On a builtin "test" platform, "sh -c test" invokes builtin "test", never the /bin/test script. exec()ing a shellscript /bin/test will invoke "sh /bin/test" inside exec(), read the /bin/test script, then basename, so a bit slower actually. (sh -c /bin/test will be the slowest path as you point out) Even if binary /bin/test is provided, modern shells having builtin "test" will actually gain a bit by "sh -c test", given /bin/sh is likely live in the cache. /bin/test is never consulted here. The only case the patch will degrade performance is ancient platforms which doesn't have "test" as a builtin and needs /bin/test binary, or the binary /bin/test is way faster than shell builtin and bare "test" is used a lot. (unlikely) I could be overlooking something; feel free for corrections. >> Speed isn't a premium for bare "test", but over the lifetime of a large >> build you can get noticeable savings by avoiding shell invocations where >> possible. A large build without a fast path can involve many thousands >> of extra shells being invoked. >> >> It's quite obviously not worth doing anything gross like figuring out >> whether the command is "test", whether "test" exists on the PATH, or >> whether it's a shell script, or anything like that. I don't think the fix will penalize in Real World, because - As you thought, bare "test" is rare - Real World Makefiles will have ||, &&, if - fi whatever after it because you usually want to do something according to "test" result. It had been fallbacking to slow path anyway. -- kabe _______________________________________________ Bug-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-make
