From owner-freebsd-current@FreeBSD.ORG Thu May 3 23:44:33 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BED69106566B for ; Thu, 3 May 2012 23:44:33 +0000 (UTC) (envelope-from areilly@bigpond.net.au) Received: from nschwmtas03p.mx.bigpond.com (nschwmtas03p.mx.bigpond.com [61.9.189.143]) by mx1.freebsd.org (Postfix) with ESMTP id 455D88FC08 for ; Thu, 3 May 2012 23:44:32 +0000 (UTC) Received: from nschwotgx04p.mx.bigpond.com ([124.188.162.192]) by nschwmtas03p.mx.bigpond.com with ESMTP id <20120503234425.CSGZ11739.nschwmtas03p.mx.bigpond.com@nschwotgx04p.mx.bigpond.com>; Thu, 3 May 2012 23:44:25 +0000 Received: from johnny.reilly.home ([124.188.162.192]) by nschwotgx04p.mx.bigpond.com with ESMTP id <20120503234425.PIO1687.nschwotgx04p.mx.bigpond.com@johnny.reilly.home>; Thu, 3 May 2012 23:44:25 +0000 Date: Fri, 4 May 2012 09:44:15 +1000 From: Andrew Reilly To: Luigi Rizzo Message-ID: <20120503234356.GD26284@johnny.reilly.home> References: <20120502182557.GA93838@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120502182557.GA93838@onelab2.iet.unipi.it> User-Agent: Mutt/1.4.2.3i X-SIH-MSG-ID: rBwwFtX4TAD0zmQs0WyzOwJxyArnqyN48Z4QX81loRIGTUDBp8DXQdrHK+ZRvN+vxC5PJhiGNGUkaa7hTY3Rs9uK Cc: current@freebsd.org, net@frebsd.org Subject: Re: fast bcopy... X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2012 23:44:33 -0000 On Wed, May 02, 2012 at 08:25:57PM +0200, Luigi Rizzo wrote: > as part of my netmap investigations, i was looking at how > expensive are memory copies, and here are a couple of findings > (first one is obvious, the second one less so) Most C compilers (well, the ones I regularly use) inline small, constant-length memcpy operations of the sort you're describing here. I would expect techniques like that to beat any amount of hand-tuning in a elf-linkage bcopy subroutine. Sure, you want a good implementation for your variable-length copies, and data layout and alignment is tremendously important these days, so there's no single silver bullet here. Cheers, -- Andrew