Skip to content

Introduce anchorFast overload

Waqar Ahmed requested to merge work/anchorFast into master

anchorFast is a new overload of 'document.anchor'. It is what it says i.e., a faster to use function. The main problem with document.anchor() is that it is often times faster to find the anchor than it is to create the return value.

The return value abstraction is overkill for the "ease" it is trying to provide. This overload just sets two properties in the return value {.line, .column} which is way faster.

Below you can see the results of running 'kateindenttest' with and without this change:

# Before
Totals: 639 passed, 0 failed, 0 skipped, 0 blacklisted, 6116ms
********* Finished testing of IndentTest *********

# Now
Totals: 639 passed, 0 failed, 0 skipped, 0 blacklisted, 5563ms
********* Finished testing of IndentTest *********

Why just this function and not others? Well, this function is heavily used by all indenter scripts so it makes sense that this works really fast.

Merge request reports