The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Eric Paris <eparis@redhat.com>
Cc: linux-kernel@vger.kernel.org, Jesse Gross <jesse@nicira.com>,
	David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] flex_array: avoid divisions when accessing elements
Date: Mon, 02 May 2011 10:36:45 -0700	[thread overview]
Message-ID: <1304357805.30823.18.camel@nimitz> (raw)
In-Reply-To: <1304357194-19308-1-git-send-email-eparis@redhat.com>

On Mon, 2011-05-02 at 13:26 -0400, Eric Paris wrote:
> On most architectures division is an expensive operation and accessing an
> element currently requires four of them.  This performance penalty
> effectively precludes flex arrays from being used on any kind of fast
> path.  However, two of these divisions can be handled at creation time and
> the others can be replaced by a reciprocal divide, completely avoiding
> real divisions on access.
> 
> Signed-off-by: Jesse Gross <jesse@nicira.com>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Eric Paris <eparis@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> [rebase on top of changes to support 0 len elements: eparis]
> [initialize part_nr when array fits entirely in base: eparis]
> Signed-off-by: Eric Paris <eparis@redhat.com> 

This seems sane to me, especially in the element access case.

Acked-by: Dave Hansen <dave@linux.vnet.ibm.com>

-- Dave


  reply	other threads:[~2011-05-02 17:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 17:26 [PATCH] flex_array: avoid divisions when accessing elements Eric Paris
2011-05-02 17:36 ` Dave Hansen [this message]
2011-05-02 20:23   ` Jesse Gross
  -- strict thread matches above, loose matches on Subject: below --
2011-04-26 20:41 [PATCH] flex_array: Avoid " Jesse Gross
2011-04-27 16:13 ` Dave Hansen
2011-04-29  1:48   ` Jesse Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304357805.30823.18.camel@nimitz \
    --to=dave@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=jesse@nicira.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox