From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Hartwig Newsgroups: gmane.lisp.guile.devel Subject: Re: vectors are something else Date: Mon, 15 Apr 2013 22:17:10 +0800 Message-ID: References: <9D053760-46BC-46F1-B84D-07902E777FF2@bluewin.ch> <63795617-219D-4416-98B7-1EC0A7B9BA71@bluewin.ch> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1366035574 32103 80.91.229.3 (15 Apr 2013 14:19:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Apr 2013 14:19:34 +0000 (UTC) Cc: guile-devel@gnu.org To: Daniel Llorens Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Apr 15 16:19:38 2013 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1URkFu-0007sj-J4 for guile-devel@m.gmane.org; Mon, 15 Apr 2013 16:19:38 +0200 Original-Received: from localhost ([::1]:59856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URkFu-0004Pc-4h for guile-devel@m.gmane.org; Mon, 15 Apr 2013 10:19:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URkDZ-00014T-S5 for guile-devel@gnu.org; Mon, 15 Apr 2013 10:17:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1URkDX-0000fG-On for guile-devel@gnu.org; Mon, 15 Apr 2013 10:17:13 -0400 Original-Received: from mail-ia0-x22e.google.com ([2607:f8b0:4001:c02::22e]:46290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URkDX-0000f5-K2 for guile-devel@gnu.org; Mon, 15 Apr 2013 10:17:11 -0400 Original-Received: by mail-ia0-f174.google.com with SMTP id o25so1556845iad.5 for ; Mon, 15 Apr 2013 07:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=npF+peuNAmeSZ6ndsLPrPLZvDVFGEtyCAF4xjsnv5yc=; b=x1LywrkAUgwz78qc8V8euG9rSH/R0EgrQnUAhWn190qhbWft/jhhjEjUGNmSynvhBh QJS4wtxGE535C3pZv4Pn1IUTiGPpS5q4WBhsUTgnr8aWzbdYwqapeHaiUf289ZLdpZd3 VYRtzrOxeUdZhxyxJy39yw2VTVYBv9NOtL3VzgfGV2708D5Cwme3ACvtOhe4FH0c+ULT rqTZueOIqC4TvPBvqrbelmecOI7jY3UZAuaHzgTFOhOLWPHXUAq7/5Wq/pr93Sr791TZ jqp1QHDsRr3GxBVvvhiZ1lJqPnVg7UJW8vTIlYuhl2oMhkEX+GAz/NT8MwRCYTOuVo0/ Olqg== X-Received: by 10.50.12.201 with SMTP id a9mr5577007igc.10.1366035430852; Mon, 15 Apr 2013 07:17:10 -0700 (PDT) Original-Received: by 10.64.26.168 with HTTP; Mon, 15 Apr 2013 07:17:10 -0700 (PDT) In-Reply-To: <63795617-219D-4416-98B7-1EC0A7B9BA71@bluewin.ch> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c02::22e X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16253 Archived-At: On 15 April 2013 22:08, Daniel Llorens wrote: > > On Apr 15, 2013, at 14:28, Daniel Hartwig wrote: > >> Is it >> really much faster to do one or the other: >> >> if lbnd !=3D 0: error >> index =3D =E2=80=A6 >> >> vs: >> >> index =3D lbnd + ... > > The second should actually be just > > index =3D ... > > You do this by having the base index point to the element at index 0 > and not to the first element. This is a mistake all through the Guile > array code. So lbnd is only for range checking. Neat. > > A branch would certainly be slower. However, if the array implementation > was exposed to the compiler, the lbnd!=3D0 check could be hoisted out of > any array loop. So both would end up being identical in that case. I see.