From: Andreas Politz <politza@hochschule-trier.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Overlays as an AA-tree
Date: Fri, 17 Feb 2017 05:58:34 +0100 [thread overview]
Message-ID: <871suxs9ad.fsf@hochschule-trier.de> (raw)
In-Reply-To: <83k28u1uyz.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 13 Feb 2017 08:11:00 +0200")
So, I did as you ask and developed a couple of performance tests
based on 3 variables. Let N = #overlays.
1. How the overlays are created
+ Either sequentially, one overlay per every other line or
randomly, with random start and random length from 0 to 70.
2. What property to use
+ One of face, display (with a string) or invisible.
3. How the overlays are accessed
+ Either start at the top scroll down and up again, or jump to
N/25 random positions and re-display there.
This gives 2*3*2=12 different tests. In all of them I
+ ran all tests once with N=12.500 and 37500 overlays.
+ used a buffer with 2*N lines and 70 columns,
+ measured display time only, i.e. not make-overlay etc. .
+ ran each test thrice and took the average.
*--------------------------------------------------------------*
+----------------------------------+
| 12.5K | 37.5K |
creation/property/action | list tree | list tree |
================================================================
|sequential/display/scroll | 6.32 5.24 | 37.59 16.47 |
| | | |
|sequential/display/random | 4.47 4.60 | 30.41 13.03 |
+---------------------------+----------------+-----------------+
|sequential/face/scroll | 7.07 5.75 | 38.18 18.64 |
| | | |
|sequential/face/random | 4.25 4.13 | 30.50 13.23 |
+---------------------------+----------------+-----------------+
|sequential/invisible/scroll| 6.63 5.02 | 36.62 16.02 |
| | | |
|sequential/invisible/random| 3.98 3.64 | 29.93 11.10 |
+---------------------------+----------------+-----------------+
|random/display/scroll | 20.39 18.6 | 88.84 58.18 |
| | | |
|random/display/random | 7.57 7.22 | 77.65 21.14 |
+---------------------------+----------------+-----------------+
|random/face/scroll | 11.16 8.75 | 88.31 27.72 |
| | | |
|random/face/random | 6.19 5.59 | 105.0 17.05 |
+---------------------------+----------------+-----------------+
|random/invisible/scroll | 9.91 7.99 | 87.01 25.97 |
| | | |
|random/invisible/random | 6.58 5.75 | 86.73 17.01 |
+---------------------------+----------------+-----------------+
| | list | tree |
+---------------------------+----------------------------------+
|make-lines-invisible | 812.67 | 1.43 |
| | | |
|line-numbering | >15m * | 112.79 |
================================================================
As you can see they stick pretty close together in the cases with
12500 overlays, while the tree performs at least twice times better
with 37500 overlays.
After that I took 2 real-world cases. The first one stems from this
[1] thread, where a user complains about the performance of his
function make-lines-invisible. The function puts overlays with an
invisible property on all lines matching a given regexp. The function
also messages the number of hidden lines after every found match,
which may be the reason for its bad performance with the current
implementation, speak re-display. This test measures the creation of
these overlays, no scrolling.
For the other case, I wrote a very simple linum.el clone. This
function creates an overlay with a margin property containing the
line-number for every line in the buffer. Here I measured creation of
the overlays as well as a full scroll up and down.
Both of the final tests were run on a ~300000 lines file with one
english word per line (/usr/share/dict/words).
* I gave up and quit the test after nothing seemed to happen on the
screen for more than 15 minutes.
So, I think this looks pretty decent.
Finally, let me note, that the tree implementation is not
completely free of quadratic worst-case performance. There are
certain patterns of overlay layout, which trigger this kind of
thing. Though, it can be argued how likely these are to occur in
a real-world scenario. Maybe I'll write a bit more about that
later.
-ap
[1] https://lists.gnu.org/archive/html/emacs-devel/2009-04/msg00242.html
next prev parent reply other threads:[~2017-02-17 4:58 UTC|newest]
Thread overview: 110+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-20 10:32 Overlays as an AA-tree Joakim Jalap
2016-09-20 12:14 ` Clément Pit--Claudel
2016-09-20 12:43 ` Lars Ingebrigtsen
2016-09-20 16:19 ` Joakim Jalap
2016-09-20 23:19 ` Richard Stallman
2016-09-20 14:40 ` Eli Zaretskii
2016-09-20 17:13 ` Joakim Jalap
2016-09-21 16:14 ` Eli Zaretskii
2016-09-22 10:35 ` Joakim Jalap
2016-09-22 12:24 ` Stefan Monnier
2016-09-21 14:52 ` Stefan Monnier
2016-09-21 15:58 ` Eli Zaretskii
2016-09-21 16:24 ` Stefan Monnier
2016-09-21 16:43 ` Eli Zaretskii
2016-09-21 18:41 ` Stefan Monnier
2016-09-21 19:28 ` Eli Zaretskii
2016-09-22 10:35 ` Joakim Jalap
2016-09-22 12:17 ` Stefan Monnier
2016-09-22 20:11 ` Joakim Jalap
2016-09-23 1:29 ` Stefan Monnier
2016-09-27 6:26 ` Joakim Jalap
2016-09-27 11:50 ` Stefan Monnier
2016-09-27 14:38 ` Eli Zaretskii
2016-09-27 16:07 ` Joakim Jalap
2016-11-21 17:32 ` Clément Pit--Claudel
2016-11-22 8:09 ` Joakim Jalap
2016-11-22 13:44 ` Stefan Monnier
2016-11-23 6:58 ` Joakim Jalap
2016-11-22 13:44 ` Clément Pit--Claudel
2016-11-22 13:55 ` Evgeny Roubinchtein
2016-11-23 7:16 ` Joakim Jalap
2016-11-23 15:42 ` Eli Zaretskii
2016-11-23 16:06 ` Stefan Monnier
2016-11-24 18:33 ` Evgeny Roubinchtein
2016-11-23 7:13 ` Joakim Jalap
2017-02-03 8:49 ` Andreas Politz
2017-02-03 9:13 ` Eli Zaretskii
2017-02-03 10:24 ` Andreas Politz
2017-02-03 11:33 ` Joakim Jalap
2017-02-03 12:44 ` Andreas Politz
2017-02-03 14:11 ` Joakim Jalap
2017-02-03 15:02 ` Andreas Politz
2017-02-03 15:23 ` Joakim Jalap
2017-02-03 15:54 ` Andreas Politz
2017-02-04 21:22 ` Stefan Monnier
2017-02-04 23:10 ` Andreas Politz
2017-02-06 9:56 ` Joakim Jalap
2017-02-06 11:33 ` Andreas Politz
2017-02-06 15:33 ` Joakim Jalap
2017-02-06 15:46 ` Stefan Monnier
2017-02-06 16:52 ` Joakim Jalap
2017-02-06 17:34 ` Stefan Monnier
2017-02-06 17:32 ` Andreas Politz
2017-02-07 12:35 ` Andreas Politz
2017-02-07 14:46 ` Joakim Jalap
2017-02-07 22:00 ` Andreas Politz
2017-02-08 0:36 ` Andreas Politz
2017-02-08 6:53 ` Joakim Jalap
2017-02-08 7:34 ` Andreas Politz
2017-02-08 8:18 ` Joakim Jalap
2017-02-08 8:44 ` Andreas Politz
2017-02-08 16:34 ` Andreas Politz
2017-02-08 17:38 ` Eli Zaretskii
2017-02-08 13:04 ` Stefan Monnier
2017-02-08 22:27 ` Andreas Politz
2017-02-08 22:34 ` Stefan Monnier
2017-02-09 9:34 ` Andreas Politz
2017-02-09 10:05 ` Joakim Jalap
2017-02-09 10:19 ` Andreas Politz
2017-02-13 3:44 ` Andreas Politz
2017-02-13 6:11 ` Eli Zaretskii
2017-02-13 9:04 ` Andreas Politz
2017-02-13 14:36 ` Eli Zaretskii
2017-02-14 10:07 ` Andreas Politz
2017-02-17 4:58 ` Andreas Politz [this message]
2017-02-17 7:12 ` Eli Zaretskii
2017-02-19 22:39 ` Andreas Politz
2017-02-19 23:10 ` Stefan Monnier
2017-02-19 23:44 ` Andreas Politz
2017-02-20 15:34 ` Eli Zaretskii
2017-02-21 6:56 ` Andreas Politz
2017-02-21 15:11 ` Stefan Monnier
2017-02-21 18:26 ` Andreas Politz
2017-02-21 19:18 ` Stefan Monnier
2017-02-21 23:36 ` Andreas Politz
2017-02-24 8:43 ` Andreas Politz
2017-04-08 13:28 ` Clément Pit-Claudel
2017-05-03 19:20 ` Andreas Politz
2017-05-03 19:40 ` Stefan Monnier
2017-05-05 20:39 ` Andreas Politz
2017-05-04 0:54 ` Clément Pit-Claudel
2017-05-05 20:10 ` Andreas Politz
2017-05-05 22:22 ` Clément Pit-Claudel
2017-05-06 8:05 ` Andreas Politz
2017-05-04 14:21 ` Eli Zaretskii
2017-05-05 20:08 ` Andreas Politz
2017-05-05 21:41 ` Eli Zaretskii
2017-09-24 13:09 ` Clément Pit-Claudel
2017-10-04 8:17 ` Andreas Politz
2017-10-04 9:22 ` Eli Zaretskii
2017-10-04 20:36 ` Andreas Politz
2017-02-14 0:45 ` Richard Stallman
2017-02-14 8:32 ` Andreas Politz
2017-02-06 13:51 ` Stefan Monnier
2017-02-06 14:26 ` Andreas Politz
2017-02-06 15:06 ` Stefan Monnier
2017-02-06 15:40 ` Joakim Jalap
2017-02-06 16:24 ` Clément Pit-Claudel
2017-02-03 13:55 ` Stefan Monnier
2017-02-03 15:14 ` Andreas Politz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871suxs9ad.fsf@hochschule-trier.de \
--to=politza@hochschule-trier.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.