]> git.gir.st - VimFx.git/commit
Improve marker generation performance
authorSimon Lydell <simon.lydell@gmail.com>
Sat, 2 Aug 2014 14:01:36 +0000 (16:01 +0200)
committerSimon Lydell <simon.lydell@gmail.com>
Sat, 2 Aug 2014 14:19:19 +0000 (16:19 +0200)
commit89e1bc43d5387da6c3bac489df50d4fd848595be
tree52fdc8d90cd69bb056b675b99bd9c344afc33269
parent5778a7476aa5786076038b651b4305fb3f867d8f
Improve marker generation performance

`getFirstNonCoveredPoint` used to recursively search the rect of an
element until it found a non-covered point. This works well most of the
time, but on some sites (such as prisjakt.se) it took way too much time.

Moreover, this technique required some CSS to be reset in a few special
cases, which is very costly performance-wise. It is also brittle and
makes the code unnecessarily complex.

Lastly, there was a bug in the algorithm that caused uncaught exceptions
sometimes (such as on youtube.com).

Now we use a much simpler approach instead.

`getFirstNonCoveredPoint` tries 6 different points of the element:

    +-------------------------------+
    |1 left-top          right-top 4|
    |                               |
    |2 left-middle    right-middle 5|
    |                               |
    |3 left-bottom    right-bottom 6|
    +-------------------------------+

If all of those are covered (or are reported as covered because of one
of the CSS special cases we used to reset) then the whole element is
simply considered to be covered. This seems to work really well.

The above means that the markers can now be placed at any of the points
in the above figure.

The result is much faster, simpler and more robust.
extension/packages/mode-hints/hints.coffee
extension/packages/mode-hints/marker.coffee
extension/resources/style.css
Imprint / Impressum