http://blog.pucp.edu.pe/media/4946/20131019-la_biblia_del_synedit_-_rev3.pdf
"De acuerdo a la comparación hecha, NO SE RECOMIENDA, de ninguna forma, implementar resaltadores de sintaxis con el algoritmo de funciones Hash"
Statement is much to broad to be generaly true.
Even your first character preselection is a hash.
A hash is simply a kind of sieve, a preselection to avoid many comparisons.
Which sieve is the cheapest in computing time depends on the string keys to process
and may vary a lot not only by implementation, but also from compiler to compiler.
Of course if I had designed the highlighters for FPC I would have used something else,
but I would never have used your first character preselection.
BTW on an ideal machine with unlimited resources.
An algorithm using character selection for every character of the string keys would be the fastest possible as it reduces the needed comparisons to zero.
Initializing boolean tables for every sieve level needed to process a given keylist
and store them in a level table to access them by a given level is feasible on todays PCs.
Zero comparisons needed.