From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.devel Subject: Re: remove-duplicates performances Date: Fri, 20 May 2011 19:46:30 +0200 Message-ID: <87ei3tcljd.fsf@gmail.com> References: <877h9lv5tl.fsf@gmail.com> <87tycpcu6t.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1305913614 22621 80.91.229.12 (20 May 2011 17:46:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 20 May 2011 17:46:54 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 20 19:46:49 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QNTmj-00068S-K5 for ged-emacs-devel@m.gmane.org; Fri, 20 May 2011 19:46:49 +0200 Original-Received: from localhost ([::1]:42798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNTmj-0001OZ-6I for ged-emacs-devel@m.gmane.org; Fri, 20 May 2011 13:46:49 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNTmf-0001KH-IB for emacs-devel@gnu.org; Fri, 20 May 2011 13:46:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QNTme-0003tY-DZ for emacs-devel@gnu.org; Fri, 20 May 2011 13:46:45 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:49707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNTme-0003tU-7n for emacs-devel@gnu.org; Fri, 20 May 2011 13:46:44 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QNTmc-00064C-5U for emacs-devel@gnu.org; Fri, 20 May 2011 19:46:42 +0200 Original-Received: from 65.77.197.77.rev.sfr.net ([77.197.77.65]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 May 2011 19:46:42 +0200 Original-Received: from thierry.volpiatto by 65.77.197.77.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 May 2011 19:46:42 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 41 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 65.77.197.77.rev.sfr.net User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:ny+mUddIy/JQNtKH9AyE1qnxrlE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:139560 Archived-At: Stefan Monnier writes: >> I go down to a list of 10 elements and it still faster: > > I'm not surprised the break-even is less than 10. > >> liste de 2X10 éléments: >> remove-duplicates 1 0.000209 0.000209 >> remove-dups 1 3.6e-05 3.6e-05 > >> liste de 2X5 éléments: >> remove-duplicates 1 7.3e-05 7.3e-05 >> remove-dups 1 6.4e-05 6.4e-05 > > Hmm... so it's faster to do it for 20 than for 10? Yes, i didn't notice that, i redo it and i have now: For 10X2==>remove-dups 1 5.2e-05 5.2e-05 For 5X2==> remove-dups 1 5.4e-05 5.4e-05 Don't know why. Can you try on your side? > I expect it is common to call remove-duplicates with very short lists > (shorter than 10 for sure) that present (almost) no duplication. Well, on small list, (shorter than ten), no need to have such a complex function, most of the time i use something like: (loop for i in '(a b a c b c) unless (memq i ls) collect i into ls finally return ls) I just tried remove-duplicates in common-lisp (slime) and i see the result on big list is instant.(i didn't instrument though) -- A+ Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997