diff options
author | Guido van Rossum <guido@python.org> | 1999-04-22 13:38:40 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-04-22 13:38:40 (GMT) |
commit | e62e76c38322ebb88bcf54a933a07291d9e7c5ba (patch) | |
tree | 27f9d2bf40c2fac433ccb2a22687f5f0035f49dd /Tools | |
parent | 693a2c65812eb61a87cacf1a23b83db35bbf9552 (diff) | |
download | cpython-e62e76c38322ebb88bcf54a933a07291d9e7c5ba.zip cpython-e62e76c38322ebb88bcf54a933a07291d9e7c5ba.tar.gz cpython-e62e76c38322ebb88bcf54a933a07291d9e7c5ba.tar.bz2 |
Super-elegant patch by Tim Peters that speeds up colorization
dramatically (up to 15 times he claims). Works by reading more than
one line at a time, up to 100-line chunks (starting with one line and
then doubling up to the limit). On a typical machine (e.g. Tim's
P5-166) this doesn't reduce interactive responsiveness in a noticeable
way.
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/idle/ColorDelegator.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Tools/idle/ColorDelegator.py b/Tools/idle/ColorDelegator.py index 5b4da7c..147f749 100644 --- a/Tools/idle/ColorDelegator.py +++ b/Tools/idle/ColorDelegator.py @@ -180,9 +180,12 @@ class ColorDelegator(Delegator): chars = "" mark = head + lines_to_get = 1 is_ok = was_ok = 0 while not (was_ok and is_ok): - next = self.index(mark + " lineend +1c") + next = self.index(mark + "+%d lines linestart" % + lines_to_get) + lines_to_get = min(lines_to_get * 2, 100) was_ok = "SYNC" in self.tag_names(next + "-1c") line = self.get(mark, next) ##print head, "get", mark, next, "->", `line` |