From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Raeburn Newsgroups: gmane.emacs.devel Subject: Re: Redundant type checking in window.c and w32menu.c Date: Tue, 19 Jun 2007 14:46:37 -0400 Message-ID: References: <4677EBCA.7020405@yandex.ru> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1182278930 21991 80.91.229.12 (19 Jun 2007 18:48:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 19 Jun 2007 18:48:50 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Antipov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 19 20:48:49 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I0ikk-000682-7T for ged-emacs-devel@m.gmane.org; Tue, 19 Jun 2007 20:48:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I0ikd-0003Gm-OQ for ged-emacs-devel@m.gmane.org; Tue, 19 Jun 2007 14:48:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I0ika-0003GW-HR for emacs-devel@gnu.org; Tue, 19 Jun 2007 14:48:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I0ikV-0003Ev-QX for emacs-devel@gnu.org; Tue, 19 Jun 2007 14:48:24 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I0ikV-0003EN-Lv for emacs-devel@gnu.org; Tue, 19 Jun 2007 14:48:19 -0400 Original-Received: from sccrmhc14.comcast.net ([204.127.200.84]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I0ik9-0006gz-1p; Tue, 19 Jun 2007 14:47:57 -0400 Original-Received: from raeburn.org (c-65-96-188-63.hsd1.ma.comcast.net[65.96.188.63]) by comcast.net (sccrmhc14) with ESMTP id <2007061918472801400l6b6ke>; Tue, 19 Jun 2007 18:47:28 +0000 Original-Received: from [69.25.196.100] (fwoosh.raeburn.org [69.25.196.100]) by raeburn.org (8.12.11/8.12.11) with ESMTP id l5JIlRmm026572; Tue, 19 Jun 2007 14:47:28 -0400 (EDT) In-Reply-To: <4677EBCA.7020405@yandex.ru> X-Mailer: Apple Mail (2.752.2) X-detected-kernel: NetCache Data OnTap 5.x X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:73326 Archived-At: On Jun 19, 2007, at 10:44, Dmitry Antipov wrote: > If we pass CHECK_CONS(), we don't need CONSP()s in Fcar() and Fcdr > () and may use XCAR() > and XCDR() instead. Makes sense. > P.S. Is code size the only reason to call Fcar(), Fcdr() and their > safe versions directly > from C code ? Replacing these dumb proxies with an appropriate > macros eliminates a lot of > function calls at the cost of ~28K increment in code size (for a > stripped binary on x86). > Note if someone needs smaller emacs executable (what a strange > requirement, but why not ?), > just replacing -O2 with -Os saves ~235K. You could make Fcar a static inline function in lisp.h (conditional on GCC, or maybe C99). If the optimizer's good at its job, it should eliminate the redundant CONSP checks. Using an inline function avoids having to check all Fcar uses for arguments that have function calls or side effects. (A quick grep shows several of those. In fact, if your test used the simple macro version, inline functions may result in less code size expansion because of this.) And personally, I think inline functions are often more readable than macros, if they're not very simple macros. Ken