From 2a4d320e7306484613723f97d1b194c988d23d51 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 13 Jul 2022 14:59:36 -0400 Subject: tests: Optimize startup ./tests.sh is about 110ms faster on my machine with this patch. --- tests/tests.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/tests.sh b/tests/tests.sh index 7854a65..5254311 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -32,14 +32,14 @@ export LS_COLORS="" unset BFS_COLORS if [ -t 1 ]; then - BLD=$(printf '\033[01m') - RED=$(printf '\033[01;31m') - GRN=$(printf '\033[01;32m') - YLW=$(printf '\033[01;33m') - BLU=$(printf '\033[01;34m') - MAG=$(printf '\033[01;35m') - CYN=$(printf '\033[01;36m') - RST=$(printf '\033[0m') + BLD=$'\033[01m' + RED=$'\033[01;31m' + GRN=$'\033[01;32m' + YLW=$'\033[01;33m' + BLU=$'\033[01;34m' + MAG=$'\033[01;35m' + CYN=$'\033[01;36m' + RST=$'\033[0m' fi UNAME=$(uname) @@ -1058,17 +1058,17 @@ function make_deep() { name="${name}${name}${name}${name}" name="${name:0:255}" + # 4 * 4 * 256 - 1 == 4095 == PATH_MAX - 1 + local names="$name/$name/$name/$name" + names="$names/$names/$names/$names" + for i in {0..9} A B C D E F; do ( mkdir "$1/$i" cd "$1/$i" - # 16 * 256 == 4096 == PATH_MAX - for _ in {1..16}; do - mkdir "$name" - cd "$name" 2>/dev/null - done - + mkdir -p "$names" + cd "$names" $TOUCH "$name" ) done -- cgit v1.2.3