From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r115095: Simplify, port and tune bool vector implementation. Date: Sun, 17 Nov 2013 04:06:55 -0800 Message-ID: <5288B15F.8060102@dancol.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1384690030 26660 80.91.229.3 (17 Nov 2013 12:07:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 17 Nov 2013 12:07:10 +0000 (UTC) To: Paul Eggert , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 17 13:07:15 2013 Return-path: Envelope-to: ged-emacs-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 1Vi18F-00083b-5G for ged-emacs-devel@m.gmane.org; Sun, 17 Nov 2013 13:07:15 +0100 Original-Received: from localhost ([::1]:38735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vi18E-0003r3-I4 for ged-emacs-devel@m.gmane.org; Sun, 17 Nov 2013 07:07:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vi185-0003qf-Sy for emacs-devel@gnu.org; Sun, 17 Nov 2013 07:07:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vi17y-0003vW-Nh for emacs-devel@gnu.org; Sun, 17 Nov 2013 07:07:05 -0500 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:46313) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vi17y-0003sb-CK for emacs-devel@gnu.org; Sun, 17 Nov 2013 07:06:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:To:MIME-Version:From:Date:Message-ID; bh=Y8EYKVYnlcy1QhnJjD1szUBDpXQTakB6RPOA+GCdhKY=; b=O+MsdQ7LKgF/LhpAwbGwWkbWDo6J8gPl9setD1PPIhFA8xg3+TlFSoOl/fvIwwRNsCa2kWl/arMIFtjoYRhOQnUQKnlaQvcXr+SoE1OWXidC8p4XoLlo4uW7xwJWH+B0xOQWGxESwYqWbDfF1ZDK3ZheZp/+7v6WtIaFnGxcSKP47/e5BeNc63u+hbYx5Rj3qXZpRzSLKeG4szGjWfTtQeDTy8zO+JabBkjvvsyhUW26haZmz17LqeRIO8jmNjgOGApZAzz4SzYbTAZm5TYmb8fFJF6lVGp/dHPRHV8etpKNv41ZaL4Ru2kaLleox+8SnxCkGpBDVizBPLNcxtUtLQ==; Original-Received: from c-76-22-66-162.hsd1.wa.comcast.net ([76.22.66.162] helo=[192.168.1.100]) by dancol.org with esmtpsa (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Vi17w-00079s-T9; Sun, 17 Nov 2013 04:06:56 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:165294 Archived-At: > (bits_word_to_host_endian): Prefer if to #if. Don't assume > chars are narrower than ints. We will never run on machines where sizeof(char) == sizeof(int). - changed |= adata[i] ^ mword; + if (! changed) + changed = adata[i] != mword; That's not an optimization. Branches are expensive on misprediction, and this branch will frequently be mispredicted. ALU operations are cheap, especially when they're done on registers and don't introduce new data hazards. It's not trivial for an optimizer to notice that using bitwise-OR here is safe. Please change the code back to the way it was before. + * data.c (bool_vector_binop_driver): Don't assume bit vectors always + contain at least one word. Zero-length bool vectors are _extremely_ uncommon. Please don't reduce efficiency in the general case. Also, from a previous patch: > (Fbool_vector_count_matches_at): Don't assume CHAR_BIT == 8. We write "CHAR_BIT" instead of "8" for clarity, not because the number of bits per byte might change. In general-purpose machines, CHAR_BIT will be 8 and might as well be a physical constant. mword >>= offset; + mword |= (bits_word) 1 << (BITS_PER_BITS_WORD - offset); count = count_trailing_zero_bits (mword); - count = min (count, BITS_PER_BITS_WORD - offset); pos++; That's a good change: cutting off the bit count is better than clamping the result of the count operatin. Thanks. Can you comment the line you added, though? Its purpose isn't immediately obvious.