Asked in r/openwrt but was left without an answer.
Can someone explain why brace expansion is so slooow in openwrt 24.10 compared to 23.05.05
To reproduce generate a colon delimited 3000 line file.
for i in {1..3000}; do
echo “$i:$i:$i:$i:$i:$i” >> myfile.txt
done
Btw u have to explicitly call bash for aforementioned script to work
Now make another script
#!/bin/bash
my_file=$(< “myfile.txt”)
my_file=${my_file//:/ }
echo “$my_file”
And try same with
my_file=$(tr ‘:’ ‘ ‘ <<<$my_file)
On ubuntu laptop all the test show that expansion is faster than with tr. in openwrt its exact opposite. In theory expansion should work faster too because it doesnt spawn a new process to deal with it but does everything in the same process so no subshell nothing.
I can confirm that expansion was working faster in 23.05.05