• Eli Zaretskii's avatar
    Speed up replace-buffer-contents · eec71ebd
    Eli Zaretskii authored
    * src/editfns.c (EXTRA_CONTEXT_FIELDS): Add a_unibyte and
    b_unibyte members.
    (rbc_quitcounter): New static variable.
    (Freplace_buffer_contents): Initialize a_unibyte, b_unibyte, and
    rbc_quitcounter.  Inhibit modification hooks if they were not
    already inhibited.  Use rarely_quit to allow user to quit, to
    avoid calling maybe_quit too frequently (which hurts performance).
    Remove redundant assertions (which hurt performance too much).
    Call signal_after_change and update_compositions after all the
    changes are done.
    (buffer_chars_equal): Remove redundant assertions (which hurt
    performance).  Avoid using BUF_FETCH_CHAR_AS_MULTIBYTE, which
    hurts performance by referencing Lisp symbols; instead, use
    lower-level macros with explicit tests to select which macro to
    use.  (Bug#31888)
    eec71ebd
editfns.c 172 KB