checkpatch: improve runtime execution speed a little
authorJoe Perches <joe@perches.com>
Wed, 22 Aug 2018 04:57:33 +0000 (21:57 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Aug 2018 17:52:48 +0000 (10:52 -0700)
commit5b57980de6b228696dfaf70ad50a8550fbb14fc7
tree31287b2ad89ad2b9860b0b02d013f7d5db5255b4
parent79682c0c00893c683678d85a402392b75e90311d
checkpatch: improve runtime execution speed a little

checkpatch repeatedly uses a runtime minimum version check that validates
the minimum perl version required for a regex match by using a "$^V ge
5.10.0" runtime string match.

Only perform that minimum version test once and store the result to reduce
string matching time.

This reduces runtime execution time for patches or files with high line
counts.

An example runtime improvement:

new: $ time ./scripts/checkpatch.pl -f drivers/net/ethernet/intel/i40e/i40e_main.c > /dev/null

real 0m11.856s
user 0m11.831s
sys 0m0.025s

old: $ time ./scripts/checkpatch.pl -f drivers/net/ethernet/intel/i40e/i40e_main.c > /dev/null

real 0m13.330s
user 0m13.282s
sys 0m0.049s

Link: http://lkml.kernel.org/r/db21aa9703833bad65ab70cc4e8a78da5b399138.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl