[PATCH 6/6] filters/syntax-highlighting.sh: Use highlight version 3 invocation

Aiden Woodruff aiden at aidenw.net
Mon Jul 27 19:34:43 UTC 2026


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2792 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20260727/0aae1dfe/attachment.p7s>


More information about the CGit mailing list