From fc6f4f31dd7cc9741a313cc010f2ec1407eb45af Mon Sep 17 00:00:00 2001 From: sharkdp Date: Sun, 12 Apr 2020 17:41:12 +0200 Subject: [PATCH] Add documentation --- tests/scripts/find-slow-to-highlight-files.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/scripts/find-slow-to-highlight-files.py b/tests/scripts/find-slow-to-highlight-files.py index be45efa6..ed9e2d9e 100644 --- a/tests/scripts/find-slow-to-highlight-files.py +++ b/tests/scripts/find-slow-to-highlight-files.py @@ -1,9 +1,23 @@ +#!/usr/bin/env python +# +# This script goes through all languages that are supported by 'bat'. For each +# language, it loops over the correspoinding file extensions and searches a +# given folder for matching files. It calls 'bat' for each of these files and +# measures the highlighting speed (number of characters per second). The script +# reports files which lead to slow highlighting speeds or errors during the +# execution of 'bat'. +# +# Requirements (external programs): +# - bat (in the $PATH) +# - fd (https://github.com/sharkdp/fd) +# - wc + import time import os import subprocess as sp -# Threshold speed in chars per second +# Threshold speed, characters per second THRESHOLD_SPEED = 20000 # Maximum time we allow `bat` to run