Problem
I coincidentally was trying to print a string to STDOUT in gnome-terminal that contains a lot of square brackets and noticed it took a lot of IO time (~4sec for ~100KB). To confirm that there is something specific about that string, I printed another string of the length, and the time is very different.
Specifically:
$ time cat file1
# ... snip ...
real 0m3.968s
user 0m0.004s
sys 0m0.001s
$ time cat file2
# ... snip ...
real 0m0.052s
user 0m0.006s
sys 0m0.001s
$ ls -l file*
-rw-rw-r-- 1 sinan sinan 115441 Dec 19 16:38 file1
-rw-rw-r-- 1 sinan sinan 115441 Dec 19 16:38 file2
I cannot tell what is the cause of the slowdown, I suspect something in gnome-terminal parses square brackets and gives them a special meaning. Does anyone have any idea?
Version Information
gnome-terminal --version:GNOME Terminal 3.36.2 using VTE 0.60.3 +BIDI +GNUTLS +ICU +SYSTEMDbash --version:GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)