Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color-identifiers-mode.el: limit (looking-back) with line beginning #64

Merged

Conversation

Hi-Angel
Copy link
Collaborator

@Hi-Angel Hi-Angel commented Aug 4, 2019

(looking-back) function has bad performance, which is explicitly documented. So
it's better to limit its use, either in general, or at least to a portion of buffer.

In my tests, search operations on Python buffers resulted in big CPU
load, which I tracked down to (looking-back) function. Limiting
the call with beginning of the buffer improved time a lot.

For testing I searched not_found_message in interpetator.py file of
meson, and measured time of (color-identifiers:scan-identifiers)
function.

Before:

(0.000129431 0 0.0)
(0.001869894 0 0.0)
(0.001798768 0 0.0)
(0.001853524 0 0.0)
(0.002508738 0 0.0)
(0.005276375 0 0.0)
(0.004376699 0 0.0)
(0.004512336 0 0.0)
(0.004265427 0 0.0)
(0.008791819 0 0.0)
(0.00790308 0 0.0)
(0.549390703 0 0.0)
(0.330451611 0 0.0)
(0.48631925 0 0.0)
(0.032972452 0 0.0)
(0.273051493 0 0.0)
(0.104208415 0 0.0)

After:

(8.4067e-05 0 0.0)
(0.001115394 0 0.0)
(0.000975669 0 0.0)
(0.001217772 0 0.0)
(0.002791122 0 0.0)
(0.002674071 0 0.0)
(0.002754122 0 0.0)
(0.001712691 0 0.0)
(0.000947949 0 0.0)
(0.000735731 0 0.0)
(0.001101217 0 0.0)
(0.001080936 0 0.0)
(0.000826694 0 0.0)
(0.000825475 0 0.0)
(0.000113389 0 0.0)
(0.001007357 0 0.0)
(0.001217875 0 0.0)

Signed-off-by: Konstantin Kharlamov [email protected]

(looking-back) function has bad performance, which is explicitly
documented. So it's better to limit its use, in general, or at least to
a portion of buffer.

In my tests, search operations on Python buffers resulted in big CPU
load, which I tracked down to (looking-back) function. Limiting
the call with beginning of the buffer improved time a lot.

For testing I searched not_found_message in interpetator.py file of
meson, and measured time of (color-identifiers:scan-identifiers)
function.

Before:

(0.000129431 0 0.0)
(0.001869894 0 0.0)
(0.001798768 0 0.0)
(0.001853524 0 0.0)
(0.002508738 0 0.0)
(0.005276375 0 0.0)
(0.004376699 0 0.0)
(0.004512336 0 0.0)
(0.004265427 0 0.0)
(0.008791819 0 0.0)
(0.00790308 0 0.0)
(0.549390703 0 0.0)
(0.330451611 0 0.0)
(0.48631925 0 0.0)
(0.032972452 0 0.0)
(0.273051493 0 0.0)
(0.104208415 0 0.0)

After:

(8.4067e-05 0 0.0)
(0.001115394 0 0.0)
(0.000975669 0 0.0)
(0.001217772 0 0.0)
(0.002791122 0 0.0)
(0.002674071 0 0.0)
(0.002754122 0 0.0)
(0.001712691 0 0.0)
(0.000947949 0 0.0)
(0.000735731 0 0.0)
(0.001101217 0 0.0)
(0.001080936 0 0.0)
(0.000826694 0 0.0)
(0.000825475 0 0.0)
(0.000113389 0 0.0)
(0.001007357 0 0.0)
(0.001217875 0 0.0)

Signed-off-by: Konstantin Kharlamov <[email protected]>
@ankurdave
Copy link
Owner

Nice, thanks!

@ankurdave ankurdave merged commit 58fc870 into ankurdave:master Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants