From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27100 invoked by alias); 25 Apr 2002 22:39:01 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 27033 invoked from network); 25 Apr 2002 22:38:59 -0000 Received: from unknown (HELO hermod.ee.princeton.edu) (128.112.48.183) by sources.redhat.com with SMTP; 25 Apr 2002 22:38:59 -0000 Received: from ivy.ee.princeton.edu (daemon@ivy.ee.princeton.edu [128.112.48.185]) by hermod.ee.princeton.edu (8.11.6/8.11.6) with ESMTP id g3PMcwq27785; Thu, 25 Apr 2002 18:38:58 -0400 (EDT) Received: (from wqin@localhost) by ivy.ee.princeton.edu (8.11.6/8.11.6) id g3PMcuR07715; Thu, 25 Apr 2002 18:38:56 -0400 (EDT) Date: Thu, 25 Apr 2002 15:47:00 -0000 From: Wei Qin To: Richard Henderson cc: gcc , gcc-help Subject: Re: Number of 1's in 64 bit number...[don't read if not interested in algos/math...] In-Reply-To: <20020425151327.A2527@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-04/txt/msg01356.txt.bz2 We ran the popcount 10 million times to get the time. So cache is hot. But we care about speed only when we have to run it a lot of times. So for speed sensitive application, I would choose to use table lookup. It's just 256 bytes anyway. Wei On Thu, 25 Apr 2002, Richard Henderson wrote: > On Thu, Apr 25, 2002 at 03:12:07PM -0400, Wei Qin wrote: > > On a x86 linux platform, it takes 80% more time than the table lookup one. > > On hot cache, maybe. On cold cache the arithmetic will > definitely be faster. > > > r~ >