[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: uniq
From: |
Lennart Borgman |
Subject: |
Re: uniq |
Date: |
Sun, 5 Dec 2010 20:15:33 +0100 |
2010/12/5 René Kyllingstad <address@hidden>:
> On Sat, Dec 4, 2010 at 3:09 PM, Stefan Monnier <address@hidden> wrote:
>>> Would it be faster to avoid nested while-loops?
>>
>> Not sure if `member' is faster than `re-search-forward', but if you
>> replace re-search-forward with just search-forward (which requires
>> a bit more care since you need to manually check that matches are
>> anchored at bol and eol) I'm pretty sure that'll be even faster since it
>> will then use a more efficient search algorithm that gets faster the
>> longer the line of text you're looking for.
>
> Even better, use a hash table to keep the already seen lines. Maybe
> call it delete-duplicate-lines, similar to delete-matching-lines.
Or maybe using a schwarzian transform to sort only line numbers and
then from this list just delete duplicates (moving backwards).
- uniq, Tak Ota, 2010/12/03
- Re: uniq, Stephen Berman, 2010/12/04
- Re: uniq, Stefan Monnier, 2010/12/04
- Re: uniq, René Kyllingstad, 2010/12/05
- Re: uniq,
Lennart Borgman <=