* [PATCH] checkpatch: Reduce is_maintained_obsolete lookup runtime
@ 2019-11-07 16:55 Joe Perches
0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2019-11-07 16:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andy Whitcroft, LKML
The is_maintained_obsolete function can be called twice
using the same filename. This function spawns a process
using get_maintainer.pl. Store the status of each filename
when spawned and use the stored result to eliminate the
spawning of unnecessary duplicate child processes.
Example:
old:
$ time ./scripts/checkpatch.pl hp100-Move-to-staging.patch > /dev/null
real 0m1.767s
user 0m1.634s
sys 0m0.141s
new:
$ time ./scripts/checkpatch.pl hp100-Move-to-staging.patch > /dev/null
real 0m1.184s
user 0m1.085s
sys 0m0.103s
Signed-off-by: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a85d719..8756c2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -888,14 +888,18 @@ sub seed_camelcase_file {
}
}
+our %maintained_status = ();
+
sub is_maintained_obsolete {
my ($filename) = @_;
return 0 if (!$tree || !(-e "$root/scripts/get_maintainer.pl"));
- my $status = `perl $root/scripts/get_maintainer.pl --status --nom --nol --nogit --nogit-fallback -f $filename 2>&1`;
+ if (!exists($maintained_status{$filename})) {
+ $maintained_status{$filename} = `perl $root/scripts/get_maintainer.pl --status --nom --nol --nogit --nogit-fallback -f $filename 2>&1`;
+ }
- return $status =~ /obsolete/i;
+ return $maintained_status{$filename} =~ /obsolete/i;
}
sub is_SPDX_License_valid {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-11-07 16:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 16:55 [PATCH] checkpatch: Reduce is_maintained_obsolete lookup runtime Joe Perches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.