* src/marker.c: Try and speed up byte<->char conversion with many markers.
commitb300052fb4ef1261519b0fd57f5eb186c2d10295
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 26 Mar 2018 13:01:30 +0000 (26 09:01 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 26 Mar 2018 13:01:30 +0000 (26 09:01 -0400)
treedcaf4fd080ac04ee6128568351b01fb693d069c0
parent9c1176247b107fd6e1845618b78ad56b5d57ddd9
* src/marker.c: Try and speed up byte<->char conversion with many markers.

When considering markers (to find a starting point for the conversion),
typically one of the two bounds is nearby (coming from
cached_(byte|char)pos) but the other is far (point-min or point-max),
so change the exit condition so we stop as soon as *one* of the bounds
is near.

(BYTECHAR_DISTANCE_INITIAL, BYTECHAR_DISTANCE_INCREMENT): New constants.
(buf_charpos_to_bytepos, buf_bytepos_to_charpos): Use them to try and
reduce the number of markers we consider.
src/marker.c