stephen is correct about what needs to be done to optimize this. other than
caching of the sort he mentions, there isn't much that can obviously be done to
speed up get-text-properties. if you look at the code you'll see it basically
boils down to a map-extents call -- and map-extents is already optimized to hell
and back. it already uses a stack of extents to optimize sequential accesses,
and extents themselves are already optimized to favor lookup over change.
"Stephen J. Turnbull" wrote:
>>>>> "Hrvoje" == Hrvoje Niksic <hniksic(a)arsdigita.com>
writes:
Hrvoje> Failing that, could the syntax code be modified to better
Hrvoje> interact with how XEmacs extents work? Like, is
Hrvoje> scan-lists really calling get-text-properties that often
Hrvoje> now? Could it be modified to call lower-level functions,
I think g-t-p already basically does that. If you need to actually
get a property that might be on any of the extents, g-t-p probably
can't be much improved on.
Hrvoje> and/or to cache the results of those calls?
It already does that, however the cache is getting invalidated a lot
more often than it needs to. (It gets invalidated on every extent
endpoint, whether that extent has a syntax table or not.) In
particular, it should be possible to keep a buffer local variable
which does not _default_ whether local syntax tables are used or not,
but rather is updated when you set a local syntax table property on an
extent in the buffer. Since only cperl mode uses them now, that would
be enough for 21.4.
Then, rather than just a flag, you generalize to keeping a list of the
extents that have syntax table properties on them, and consult that
rather than doing g-t-p.
Hrvoje> The redisplay code already contains similar optimizations,
Hrvoje> which include the concept of "extent runs" and "stacks of
Hrvoje> extents".
This is another good idea, since font-locking closely resembles
redisplay in a lot of ways.
--
Institute of Policy and Planning Sciences
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Don't ask how you can "do" free software business;
ask what your business can "do for" free software.