all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ken Raeburn <raeburn@gnu.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: Redundant type checking in window.c and w32menu.c
Date: Tue, 19 Jun 2007 14:46:37 -0400	[thread overview]
Message-ID: <DB033EB0-A4BC-42DE-889F-0B52DD31081F@gnu.org> (raw)
In-Reply-To: <4677EBCA.7020405@yandex.ru>

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

  parent reply	other threads:[~2007-06-19 18:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-19 14:44 Redundant type checking in window.c and w32menu.c Dmitry Antipov
2007-06-19 14:55 ` Stefan Monnier
2007-06-19 18:46 ` Ken Raeburn [this message]
2007-06-20 14:12   ` Dmitry Antipov
2007-06-20 15:20     ` Jason Rumney
2007-06-20 17:55       ` dmantipov
2007-06-20 20:46         ` Jason Rumney
2007-06-21 15:46           ` Dmitry Antipov
2007-06-21 17:38           ` Ken Raeburn
2007-06-20 20:12     ` Tom Tromey

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=DB033EB0-A4BC-42DE-889F-0B52DD31081F@gnu.org \
    --to=raeburn@gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.