aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/home/.local/bin/terminal-benchmark
blob: 78923a89639dbcac76bd3673537c42c0a5e8c3be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash

MAX_RETRIES=100000
START=$(date +%s.%N)
#6*42 + 48
for i in {1..100000}; do
  echo -e '\r';
  echo -e '\033[0K\033[1mBold\033[0m \033[7mInvert\033[0m \033[4mUnderline\033[0m';
  echo -e '\033[0K\033[1m\033[7m\033[4mBold & Invert & Underline\033[0m';
  echo;
  echo -e '\033[0K\033[31m Red \033[32m Green \033[33m Yellow \033[34m Blue \033[35m Magenta \033[36m Cyan \033[0m';
  echo -e '\033[0K\033[1m\033[4m\033[31m Red \033[32m Green \033[33m Yellow \033[34m Blue \033[35m Magenta \033[36m Cyan \033[0m';
  echo;
  echo -e '\033[0K\033[41m Red \033[42m Green \033[43m Yellow \033[44m Blue \033[45m Magenta \033[46m Cyan \033[0m';
  echo -e '\033[0K\033[1m\033[4m\033[41m Red \033[42m Green \033[43m Yellow \033[44m Blue \033[45m Magenta \033[46m Cyan \033[0m';
  echo;
  echo -e '\033[0K\033[30m\033[41m Red \033[42m Green \033[43m Yellow \033[44m Blue \033[45m Magenta \033[46m Cyan \033[0m';
  echo -e '\033[0K\033[30m\033[1m\033[4m\033[41m Red \033[42m Green \033[43m Yellow \033[44m Blue \033[45m Magenta \033[46m Cyan \033[0m';
done
END=$(date +%s.%N)
echo "Coloured output test takes: " + "$(echo "($END - $START)" | bc)" + " seconds"
COLOURED_OUPUT=$(echo "(300 * $MAX_RETRIES) / ($END - $START)" | bc)


START=$(date +%s.%N)
for i in {1..100000}; do
  echo -e '\r';
  echo -e '🎫💋📂💣💒💁💀💳📄📕📦📷🔈🔙🔪🔻🔻🕊🕊🕛🕬🕽🖎🖎🖎🖍🖞🗀🗑🗢🗳🗡🗤🗣🗺🗻🗼🗽🗾🗿🗮🗝🗌🖻🖪🖙🖈🕷🕦🕕🔳🔢🔑🔀📯📞📍💼💫💚💉👸👧👖🐴🐣🐒🐁🏰🏟🏎🎽🎬🎛🎊🍹🍨🍗';
done
END=$(date +%s.%N)
echo "Unicode output test takes: " "$(echo "($END - $START)" | bc)" " seconds"
UNICODE_OUPUT=$(echo "(139 * $MAX_RETRIES) / ($END - $START)" | bc)


START=$(date +%s.%N)
for i in {1..100000}; do
  echo -e '\r';
  echo -e 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ';
done
END=$(date +%s.%N)
echo "Non-unicode output test takes: " "$(echo "($END - $START)" | bc)" " seconds"
NONE_UNICODE_OUPUT=$(echo "(118 * $MAX_RETRIES) / ($END - $START)" | bc)

test_output='';
START=$(date +%s.%N)
for x in {1..10}; do
  test_output="${test_output} a🎫"
  for i in {1..100000}; do
    echo -e '\r';
    echo -e "$test_output";
  done
done
END=$(date +%s.%N)
echo "Mixed output test takes: " "$(echo "($END - $START)" | bc)" " seconds"
MIXED_OUPUT=$(echo "(165 * $MAX_RETRIES) / ($END - $START)" | bc)


echo "${COLOURED_OUPUT} coloured characters per second"
echo "${UNICODE_OUPUT} unicode characters per second"
echo "${NONE_UNICODE_OUPUT} none-unicode characters per second"
echo "${MIXED_OUPUT} Mixed characters per second"