[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Case mapping of sharp s
From: |
Kenichi Handa |
Subject: |
Re: Case mapping of sharp s |
Date: |
Tue, 24 Nov 2009 21:26:17 +0900 |
In article <address@hidden>, Andreas Schwab <address@hidden> writes:
> Ulrich Mueller <address@hidden> writes:
> > Is that the reason for the backwards search in ERC buffers being
> > extremely slow? It may keep Emacs busy for several *minutes*. And it's
> > not interruptible with C-g.
> Does this patch help?
Here are some ideas to improve it.
(1) Do forward matching in backward search.
The original code roughly does this to search "012abc"
for "012" from the tail.
check if "012" matches with "abc"
check if "012" matches with "2ab"
...
But the new code does this:
check if "210" matches with "cba"
check if "210" matches with "ba2"
...
As INC_BOTH is faster than DEC_BOTH, the original way of
check matching is faster. The slowness of the orignal code
was caused by using CHAR_TO_BYTE to find the place of "2"
when you know the place of "a". Use DEC_BOTH here only.
(2) Pre-compute the character codes in PAT in an integer
array if LEN is not that long (perhaps LEN < 256, or
at most, sizeof (int) * LEN < MAX_ALLOCA).
Then, you don't need the repeated STRING_CHAR on PAT. This
can be applicable to forward search too.
(3) In addition to (2), pre-compute the character codes in
BUF too in an array of the same length as (2).
Then you can avoid using STRING_CHAR and TRANSLATE
repeatedly on the same place of BUF. This requires modulo
calculation to get an index of the array, but I think it's
faster than the combination of STRING_CHAR and TRANSLATE.
---
Kenichi Handa
address@hidden
- Re: Case mapping of sharp s, (continued)
- Re: Case mapping of sharp s, grischka, 2009/11/21
- Re: Case mapping of sharp s, Ulrich Mueller, 2009/11/21
- Re: Case mapping of sharp s, Andreas Schwab, 2009/11/21
- Re: Case mapping of sharp s, Ulrich Mueller, 2009/11/21
- Re: Case mapping of sharp s, Andreas Schwab, 2009/11/22
- Re: Case mapping of sharp s, Stefan Monnier, 2009/11/22
- Re: Case mapping of sharp s,
Kenichi Handa <=
- Re: Case mapping of sharp s, grischka, 2009/11/24
- Re: Case mapping of sharp s, Kenichi Handa, 2009/11/24
- Re: Case mapping of sharp s, grischka, 2009/11/26
- Re: Case mapping of sharp s, Juri Linkov, 2009/11/29
- Re: Case mapping of sharp s, Stefan Monnier, 2009/11/29
- Re: Case mapping of sharp s, Kenichi Handa, 2009/11/29
- Re: Case mapping of sharp s, Kenichi Handa, 2009/11/29
- Re: Case mapping of sharp s, Ulrich Mueller, 2009/11/30
- Re: Case mapping of sharp s, Juri Linkov, 2009/11/30
- Re: Case mapping of sharp s, martin rudalics, 2009/11/30