aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/ui
diff options
context:
space:
mode:
authorLibravatar René Kijewski <rene.kijewski@fu-berlin.de>2023-03-30 06:28:26 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-03-30 14:49:15 +0200
commit6daf343e8b1b99cb776e244f9f8e658e1887e633 (patch)
tree0a4d70840c9f97e8f27d59511779fbc061451f36 /testing/tests/ui
parent5ff19267021d7d04cd772e8da28446a742a35720 (diff)
downloadaskama-6daf343e8b1b99cb776e244f9f8e658e1887e633.tar.gz
askama-6daf343e8b1b99cb776e244f9f8e658e1887e633.tar.bz2
askama-6daf343e8b1b99cb776e244f9f8e658e1887e633.zip
Escape HTML faster
Escaped HTML characters vary in length. So, in order to select the correct replacement two variables need to be loaded: The pointer to the new substring and its length. Because of this the generated code is less dense than it could be. With this PR instead of selecting the appropriate `&str`, an `&&str` is selected. The former consumes two words while the latter consumes only one. Intuitively one might assume that the double dereference makes the code slower, but the optimized lookup seems to be so much faster, so that the change is worth its weight. Comparing the result of `cargo bench` (best out of three runs for both): ```text Old: [4.3592 µs 4.3675 µs 4.3764 µs] New: [3.8691 µs 3.8766 µs 3.8860 µs] Diff: [-11.24 % -11.24 % -12.21 % ] ```
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions