Merge: lib/core: Optimized `html_escape` for FlatText variants
authorJean Privat <jean@pryen.org>
Wed, 21 Oct 2015 01:10:06 +0000 (21:10 -0400)
committerJean Privat <jean@pryen.org>
Wed, 21 Oct 2015 01:10:06 +0000 (21:10 -0400)
commitc3512b94f63520d4979a19ad92254cc2af2df72d
treef7af174bf23a8138f93266e41d43602b8900ded5
parentf0adfb292e67b7bbdfb0383601fcdfdb642e9603
parentff1b3e86e3b5cfadf68a3d8374df7793a09eb285
Merge: lib/core: Optimized `html_escape` for FlatText variants

As @privat requested, a byte-oriented optimized version of `FlatText` for `FlatString` as it is the most common case, like `escape_to_c`, it works at the byte level to accelerate fetching of characters.

On a short test program

~~~nit
var s = ""
for i in [0 .. 2000[ do s = "&lt;STRING&#47;&rt;".html_escape
~~~

Valgrind reports an old runtime of 18.208 MIr with a 8856 Ir/call to `html_escape`; the new runtime is 3.093 MIr, which translates to a 1298 Ir/call.

Pull-Request: #1775
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>