{"thread":{"id":"49470","subject":"[PATCH v2] coccicheck: process every source file at once","startedAt":"2018-10-02T20:04:00Z","lastAt":"2018-10-02T20:04:40Z","messageCount":2,"participants":["Jacob Keller"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"359458","messageId":"20181002200353.13412-1-jacob.e.keller@intel.com","threadId":"49470","inReplyTo":null,"subject":"[PATCH v2] coccicheck: process every source file at once","fromName":"Jacob Keller","fromEmail":"jacob.e.keller@intel.com","sentAt":"2018-10-02T20:03:53Z","receivedAt":"2018-10-02T20:04:00Z","isPatch":true,"sender":{"key":"jacob.e.keller@intel.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"From: Jacob Keller <jacob.keller@gmail.com>\n\nmake coccicheck is used in order to apply coccinelle semantic patches,\nand see if any of the transformations found within contrib/coccinelle/\ncan be applied to the current code base.\n\nPass every file to a single invocation of spatch, instead of running\nspatch once per source file.\n\nThis reduces the time required to run make coccicheck by a significant\namount of time:\n\nPrior timing of make coccicheck\n  real    6m14.090s\n  user    25m2.606s\n  sys     1m22.919s\n\nNew timing of make coccicheck\n  real    1m36.580s\n  user    7m55.933s\n  sys     0m18.219s\n\nThis is nearly a 4x decrease in the time required to run make\ncoccicheck. This is due to the overhead of restarting spatch for every\nfile. By processing all files at once, we can amortize this startup cost\nacross the total number of files, rather than paying it once per file.\n\nSigned-off-by: Jacob Keller <jacob.keller@gmail.com>\n---\n Makefile | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex df1df9db78da..b9947f3f51ec 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2715,10 +2715,8 @@ endif\n %.cocci.patch: %.cocci $(COCCI_SOURCES)\n \t@echo '    ' SPATCH $<; \\\n \tret=0; \\\n-\tfor f in $(COCCI_SOURCES); do \\\n-\t\t$(SPATCH) --sp-file $< $$f $(SPATCH_FLAGS) || \\\n-\t\t\t{ ret=$$?; break; }; \\\n-\tdone >$@+ 2>$@.log; \\\n+\t( $(SPATCH) --sp-file $< $(COCCI_SOURCES) $(SPATCH_FLAGS) || \\\n+\t\t{ ret=$$?; }; ) >$@+ 2>$@.log; \\\n \tif test $$ret != 0; \\\n \tthen \\\n \t\tcat $@.log; \\\n-- \n2.18.0.219.gaf81d287a9da\n\n"},{"id":"359459","messageId":"CA+P7+xqWDyxR7jWQ-YEH2YUdCYQCg3KYpHEOnVcPY75XLrLxNw@mail.gmail.com","threadId":"49470","inReplyTo":"20181002200353.13412-1-jacob.e.keller@intel.com","subject":"Re: [PATCH v2] coccicheck: process every source file at once","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2018-10-02T20:04:25Z","receivedAt":"2018-10-02T20:04:40Z","isPatch":true,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Tue, Oct 2, 2018 at 1:03 PM Jacob Keller <jacob.e.keller@intel.com> wrote:\n>\n> From: Jacob Keller <jacob.keller@gmail.com>\n>\n> make coccicheck is used in order to apply coccinelle semantic patches,\n> and see if any of the transformations found within contrib/coccinelle/\n> can be applied to the current code base.\n>\n> Pass every file to a single invocation of spatch, instead of running\n> spatch once per source file.\n>\n> This reduces the time required to run make coccicheck by a significant\n> amount of time:\n>\n> Prior timing of make coccicheck\n>   real    6m14.090s\n>   user    25m2.606s\n>   sys     1m22.919s\n>\n> New timing of make coccicheck\n>   real    1m36.580s\n>   user    7m55.933s\n>   sys     0m18.219s\n>\n> This is nearly a 4x decrease in the time required to run make\n> coccicheck. This is due to the overhead of restarting spatch for every\n> file. By processing all files at once, we can amortize this startup cost\n> across the total number of files, rather than paying it once per file.\n>\n> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>\n> ---\n\nWoops, ignore this version, it doesn't quite work.\n\nThanks,\nJake\n"}]}