From 9afac63acc7ab4f34890554a1f91efa12acbfec9 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Wed, 18 Sep 2019 11:17:40 +0200 Subject: [PATCH] TT#65907 Speedup 'ngcpcfg build' (2-3 seconds faster when we build all files) We are performing complex manipulations with list of files to be build to understand which tt2 file we should use: .tt2/customtt.tt2/tt2.sp1/... In the same time 90% of our files has only .tt2, so let's check the count here and use the $file if only one record is available to proceed. Change-Id: Ib754390563a93a1fbdeb4a4147b066fcb53ed5cc --- functions/main | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/functions/main b/functions/main index ba4e3762..e9ac0412 100644 --- a/functions/main +++ b/functions/main @@ -273,6 +273,13 @@ generate_template_list() { normalized_filename="${normalized_filename%.customtt.tt2}" normalized_filename="${normalized_filename%.tt2}" + # skipping all further checks IF we have only one entry in 'filelist_prepared' (90% cases) + if [[ "$(grep -Ec "^${normalized_filename}" "${filelist_prepared}")" == "1" ]]; then + log_debug "Using the only one available file '${line}' matching on '${normalized_filename}'" + echo "${line}" >> "${filelist_final}" + continue + fi + # foo.custom.tt2.hostname if [ -n "${HOST_FILE:-}" ] ; then if grep -q -- "^${normalized_filename}.customtt.tt2${HOST_FILE}$" "${filelist_prepared}" ; then