I would say almost zero is algorithmic, as Chroma very closely adheres to the design of Pygments.
The improvement is due to two factors, with the first being by far the biggest factor:
1. Hugo no longer has to call an external `pygmentize` tool for every highlight. This removes the overhead of the fork/exec, as well as the (not-insignificant) overhead of the Python interpreter starting up.
2. Go is generally a faster language than Python.
The caveat with 2 is that Python can spend large amounts of time in C, eg. doing regex matching.
https://mobile.twitter.com/GoHugoIO/status/91158254224715366...