From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Nordl=F6w?= Newsgroups: gmane.emacs.help Subject: Re: Vector and List Performance Date: Tue, 9 Jun 2009 11:13:45 -0700 (PDT) Organization: http://groups.google.com Message-ID: <629c22c4-bad6-43cd-9386-ca21713b088b@s16g2000vbp.googlegroups.com> References: <7c63f5n48y.fsf@pbourguignon.informatimago.com> <4b62dc88-b861-4f9c-82d6-e175b2247c45@w40g2000yqd.googlegroups.com> <7cd49d6051.fsf@pbourguignon.anevia.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1244572845 24724 80.91.229.12 (9 Jun 2009 18:40:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Jun 2009 18:40:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 09 20:40:42 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ME6FT-0001h4-7N for geh-help-gnu-emacs@m.gmane.org; Tue, 09 Jun 2009 20:40:39 +0200 Original-Received: from localhost ([127.0.0.1]:47887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ME6FS-00030Q-LQ for geh-help-gnu-emacs@m.gmane.org; Tue, 09 Jun 2009 14:40:38 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!postnews.google.com!s16g2000vbp.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-NNTP-Posting-Host: 81.170.250.228 Original-X-Trace: posting.google.com 1244571225 28554 127.0.0.1 (9 Jun 2009 18:13:45 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 9 Jun 2009 18:13:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s16g2000vbp.googlegroups.com; posting-host=81.170.250.228; posting-account=ytJKAgoAAAA1tg4ScoRszebXiIldA5vg User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1pre) Gecko/20090605 Ubuntu/9.04 (jaunty) Shiretoko/3.5pre, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:169864 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:65095 Archived-At: On Jun 9, 2:51=A0pm, p...@informatimago.com (Pascal J. Bourguignon) wrote: > Nordl=F6w writes: > > Aahh, we needed a macro instead: > > > (defmacro bench (&rest forms) > > =A0 =A0 "Convenience wrapper for benchmark-run-compiled." > > =A0 =A0 `(let ((n 10)) > > =A0 =A0 =A0 =A0(/ (nth 0 (benchmark-run n ,@forms)) n))) > > > This gives a reasonable difference in performance. > > > By the way, does elisp lists have extra pointers to the middle of the > > list (a skip-list)? > > No, because it wouldn't be efficient to have to maintain them. > > (let* ((c (list 7 8 9)) > =A0 =A0 =A0 =A0(b (list* 4 5 6 c)) > =A0 =A0 =A0 =A0(a (list* 1 2 3 b))) > =A0 =A0 (push -1 (cddr c)) =A0(push -2 (cddr c)) =A0; you may have to upd= ate a big number of skip-lists! > =A0 =A0 (list a b c)) > --> > ((1 2 3 . #1=3D(4 5 6 . #2=3D(7 8 -2 -1 9))) #1# #2#) > > (deftype list () '(or null (cons t list))) ; nothing more. > > -- > __Pascal Bourguignon__ I tested the performance difference and strangely the vector version of my benchmarking is only faster when the number of elements exceeds roughy 1000. Why is this? Shouldn' aref() always be faster than nth regardless of the size of the sequence? /Per Nordl=F6w