on master help sign in
Add documentation
fc6f4f3sharkdp
tests/scripts/find-slow-to-highlight-files.py+15−1
@@ -1,9 +1,23 @@
1+#!/usr/bin/env python
2+#
3+# This script goes through all languages that are supported by 'bat'. For each
4+# language, it loops over the correspoinding file extensions and searches a
5+# given folder for matching files. It calls 'bat' for each of these files and
6+# measures the highlighting speed (number of characters per second). The script
7+# reports files which lead to slow highlighting speeds or errors during the
8+# execution of 'bat'.
9+#
10+# Requirements (external programs):
11+# - bat (in the $PATH)
12+# - fd (https://github.com/sharkdp/fd)
13+# - wc
14+
1import time
15import time
2import os
16import os
3import subprocess as sp
17import subprocess as sp
4
18
5
19
6−# Threshold speed in chars per second
20+# Threshold speed, characters per second
7THRESHOLD_SPEED = 20000
21THRESHOLD_SPEED = 20000
8
22
9# Maximum time we allow `bat` to run
23# Maximum time we allow `bat` to run