emacs-devel
[Top][All Lists]
Advanced

[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).



reply via email to

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