emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading souce Elisp faster


From: Kenichi Handa
Subject: Re: Loading souce Elisp faster
Date: Thu, 28 Feb 2013 23:10:57 +0900

In article <address@hidden>, Richard Stallman <address@hidden> writes:

> This change in decode_coding_utf_8 should make it considerably faster
> in the usual case where few characters need conversion.

Even with that change, the decoder still copies the source
bytes to the array coding->charbuf, then store characters in
coding->charbuf into the destination buffer.  I think the
better place of tuning is in the function decode_coding.  It
has do-while loop that basically does this:

  do 
    {
      /* decode the source bytes and store characters in charbuf */
      (*(coding->decoder)) (coding);
      /* insert characters of charbuf in the destination buffer. */
      produce_chars (coding, translation_table, 0);
    }
  while (...)

We can change that to:

  do
    {
      int ascii_bytes = find_ascii_chars_in_source (coding);
      if (ascii_bytes > SHORT_CUT_THRESHOLD)
        {
           /* Copy source bytes directly to destination buffer.
              For reading a buffer, source bytes are in a
              gap area of the destination buffer.  So, with
              careful programming, we may even be able to avoid
              this coping.
            */
        }
      else 
        {
          (*(coding->decoder)) (coding);
          produce_chars (coding, translation_table, 0);
        }
    }
  while (...)

---
Kenichi Handa
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]