From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: uniq Date: Sun, 5 Dec 2010 20:15:33 +0100 Message-ID: References: <20101203.184112.37434497.Takaaki.Ota@am.sony.com> <87ipz9hhab.fsf@escher.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1291576566 12603 80.91.229.12 (5 Dec 2010 19:16:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 5 Dec 2010 19:16:06 +0000 (UTC) Cc: Stephen Berman , Stefan Monnier , emacs-devel@gnu.org To: =?UTF-8?Q?Ren=C3=A9_Kyllingstad?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 05 20:16:01 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PPK40-0004GH-Jg for ged-emacs-devel@m.gmane.org; Sun, 05 Dec 2010 20:16:01 +0100 Original-Received: from localhost ([127.0.0.1]:40763 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPK40-0006fZ-1Z for ged-emacs-devel@m.gmane.org; Sun, 05 Dec 2010 14:16:00 -0500 Original-Received: from [140.186.70.92] (port=42169 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPK3v-0006cZ-Qo for emacs-devel@gnu.org; Sun, 05 Dec 2010 14:15:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PPK3u-0000uc-LL for emacs-devel@gnu.org; Sun, 05 Dec 2010 14:15:55 -0500 Original-Received: from mail-ew0-f43.google.com ([209.85.215.43]:36577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PPK3u-0000uL-CK for emacs-devel@gnu.org; Sun, 05 Dec 2010 14:15:54 -0500 Original-Received: by ewy22 with SMTP id 22so7847364ewy.30 for ; Sun, 05 Dec 2010 11:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=uJE6GXJITsQbQNO44n9tHcB6ufDJP0ojDZl4Y8h2lKM=; b=sQlY7nAlF3BNbUFOb+u8rQy4l3XUZKeugDahHZ/wOY9VRJjUnAif/Tv77occxlC0nn Cpmg/dmD/by5P+QRLqd79uNZ2xWUIto5v6Z2ludnuYuCWCeT+w64DLrNh9EBx+UPjiGq RxbB0Gt9tbhLujVBOVLZLO48WTKXI2AohWe20= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=SfZi8OJgwFTWwJpqZhUGOXqOKuhtgkMnbPBgtVNMsOj1Zh48jxeE842JqI/NQg58Y9 sDor77N8EyFjR/Sc46HNaLz1rKmydSB0y3sx607eYMlzBM20ujgHPr0fjWK+c/Oc9BMJ l47XGGN2ZkfULd6q/SvGSGq4Ui25TXVrIxRpk= Original-Received: by 10.213.14.79 with SMTP id f15mr4721175eba.58.1291576553515; Sun, 05 Dec 2010 11:15:53 -0800 (PST) Original-Received: by 10.213.29.8 with HTTP; Sun, 5 Dec 2010 11:15:33 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:133436 Archived-At: 2010/12/5 Ren=C3=A9 Kyllingstad : > On Sat, Dec 4, 2010 at 3:09 PM, Stefan Monnier = 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).