On 7/21/2026 7:33 AM, Sven Göthel wrote:
instead of these extra calls and work,
we could also add a
filters/syntax-highlighting3.sh file
to be picked up by the cgitrc or not.
The performance note is a good point. I compared the time to highlight some random lua sources sitting around, and a dynamic version check is probably reasonable (10% slower) for larger files but doubles the time for negligibly small files. I think adding a separate file to point to in /etc/cgitrc is probably a little simpler and avoids being overwritten by a package update.

$ time for i in $(seq 100); do highlight_version=$(highlight --version | \
  sed 's/^ highlight version //;t m;d;b;:m;s/\.[0-9]*$//'); done

real    0m0.324s
user    0m0.358s
sys    0m0.160s

$ wc -l src/luarocks/deps.lua; time for i in $(seq 100); do \
  highlight --force -f -I -O xhtml -S lua >/dev/null 2>&1 <src/luarocks/deps.lua; done
877 src/luarocks/deps.lua

real    0m3.924s
user    0m3.691s
sys    0m0.235s

$ wc -l src/luarocks/require.lua; time for i in $(seq 100); do \
  highlight --force -f -I -O xhtml -S lua >/dev/null 2>&1 <src/luarocks/require.lua; done
2 src/luarocks/require.lua

real    0m0.476s
user    0m0.341s
sys    0m0.143s

--
Aiden Woodruff


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to