From b25a73f26a6b61ad4eee24e47a1db3d00e528955 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 6 Sep 2021 17:21:16 +0200 Subject: [PATCH] build: pass a tuple of alternatives to str.endswith() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://docs.python.org/3/library/stdtypes.html#str.endswith One function call should be faster than three function calls per file. PR-URL: https://github.com/nodejs/node/pull/40017 Reviewed-By: Richard Lau Reviewed-By: Michaël Zasso Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Shingo Inoue Reviewed-By: Tobias Nießen Reviewed-By: Darshan Sen --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 9327d6e5f5d..6efb98c2316 100755 --- a/configure.py +++ b/configure.py @@ -1512,7 +1512,7 @@ def glob_to_var(dir_base, dir_sub, patch_dir): for ent in files: (path, dirs, files) = ent for file in files: - if file.endswith('.cpp') or file.endswith('.c') or file.endswith('.h'): + if file.endswith(('.cpp', '.c', '.h')): # srcfile uses "slash" as dir separator as its output is consumed by gyp srcfile = '%s/%s' % (dir_sub, file) if patch_dir: