From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-devel@gnu.org
Subject: Re: defsubst VS defun or defmacro [was RE: Compiled code in Emacs-26 will fail in Emacs-25 if use pcase]
Date: Thu, 23 Feb 2017 19:14:43 -0800 [thread overview]
Message-ID: <87mvdcfffg.fsf@pellet> (raw)
In-Reply-To: alpine.DEB.2.20.1702241055490.8153@calancha-pc
Tino Calancha <tino.calancha@gmail.com> writes:
> On Thu, 23 Feb 2017, T.V Raman wrote:
>
>> Please separate your personal opinion from fact. And asserting that
>> using defsubst is "misguided " is not a useful way of carrying on a
>> conversation.
>>
>> Drew Adams writes:
>> > > Really? What should we be using, and when was defsubst deprecated?
>> > > defun or defmacro
>> > It has not been deprecated.
>> > I was expressing my opinion: It's rarely, if ever, needed,
>> > and misguided uses of it instead of defun are bothersome.
>
> Hi Raman,
> I guess Drew meant that defsubst makes debugging harder. It also
> complicates advising. I know he does extensively use of advising
> in his own libraries.
>
> The manual mention some disadvantages on using defsubst
> in `(elisp) inline functions':
>
> "Also, inline functions do not behave well with respect to debugging,
> tracing, and advising (*note Advising Functions::). Since ease of
> debugging and the flexibility of redefining functions are important
> features of Emacs, you should not make a function inline, even if it’s
> small, unless its speed is really crucial, and you’ve timed the code to
> verify that using ‘defun’ actually has performance problems."
>
> I find worth to read the whole node. I used to be confused about when
> to use (to not) defsubst.
I read that, and still have one question -- is there any practical
difference in the compiled performance of a defsubst vs a macro? I'd
been under the (probably unfounded) impression that if you were using a
macro just to DRY a code snippet, and not using any of its other
features, you'd get better performance with a defsubst.
But probably I just made that up? After byte compilation, is there any
difference between the two (again, assuming you're not using backquotes
or any special macro functionality)?
Eric
next prev parent reply other threads:[~2017-02-24 3:14 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 17:50 [PATCH]: Add new bytecode op `switch' for implementing branch tables Vibhav Pant
2017-02-06 18:30 ` Stefan Monnier
2017-02-07 8:45 ` Vibhav Pant
2017-02-07 14:41 ` Stefan Monnier
[not found] ` <CA+T2Sh3N09WGoHtNL3BbptsKA1ZdwWedTNDd0vmeBe0fTO5a1g@mail.gmail.com>
[not found] ` <CA+T2Sh2sa6=WOvyePzL_ACR0Nw=jTnZze_xXFcvL=22OURP=ZA@mail.gmail.com>
2017-02-07 15:21 ` Vibhav Pant
2017-02-07 13:50 ` Vibhav Pant
2017-02-07 15:56 ` Clément Pit-Claudel
2017-02-08 13:38 ` Vibhav Pant
2017-02-08 16:21 ` Vibhav Pant
2017-02-08 17:46 ` Vibhav Pant
2017-02-09 13:21 ` Stefan Monnier
2017-02-08 17:56 ` Eli Zaretskii
2017-02-23 4:35 ` Compiled code in Emacs-26 will fail in Emacs-25 if use pcase [was: Add new bytecode op `switch' for implementing branch tables.] Tino Calancha
2017-02-23 8:36 ` Richard Copley
2017-02-23 10:12 ` Tino Calancha
2022-07-04 12:24 ` Vibhav Pant
2017-02-23 13:39 ` Stefan Monnier
2017-02-23 14:33 ` Kaushal Modi
2017-02-23 15:10 ` Stefan Monnier
2022-07-02 20:31 ` Robert Weiner
2022-07-02 21:28 ` Stefan Monnier
[not found] ` <CA+T2Sh29UhuNrhRZG=PPQbYYHtONXwyb8dX4rBVLmwdORLELhg@mail.gmail.com>
2017-02-23 17:50 ` Vibhav Pant
2017-04-11 17:40 ` Compiled code in Emacs-26 will fail in Emacs-25 if use pcase Lars Brinkhoff
2017-02-23 16:15 ` Compiled code in Emacs-26 will fail in Emacs-25 if use pcase [was: Add new bytecode op `switch' for implementing branch tables.] raman
2017-02-23 17:24 ` Drew Adams
2017-02-23 17:50 ` T.V Raman
2017-02-23 18:02 ` Drew Adams
2017-02-23 18:24 ` T.V Raman
2017-02-23 19:00 ` Drew Adams
2017-02-24 2:06 ` defsubst VS defun or defmacro [was RE: Compiled code in Emacs-26 will fail in Emacs-25 if use pcase] Tino Calancha
2017-02-24 3:14 ` Eric Abrahamsen [this message]
2017-02-24 3:56 ` raman
2017-02-24 4:20 ` Eric Abrahamsen
2017-02-24 3:51 ` raman
2017-02-09 17:32 ` [PATCH]: Add new bytecode op `switch' for implementing branch tables Clément Pit-Claudel
2017-02-09 19:15 ` Clément Pit-Claudel
2017-02-10 4:12 ` Vibhav Pant
2017-02-10 4:17 ` Clément Pit-Claudel
2017-02-10 5:03 ` Vibhav Pant
2017-02-10 6:07 ` Stefan Monnier
2017-02-10 13:51 ` Vibhav Pant
2017-02-10 15:12 ` Stefan Monnier
2017-02-10 17:59 ` Vibhav Pant
2017-02-10 18:25 ` Vibhav Pant
2017-02-10 20:47 ` Paul Eggert
2017-02-10 20:58 ` Stefan Monnier
2017-02-11 15:07 ` Vibhav Pant
2017-02-12 3:10 ` Vibhav Pant
2017-02-13 7:18 ` Vibhav Pant
2017-02-09 16:37 ` Vibhav Pant
2017-02-06 19:32 ` Eli Zaretskii
2017-02-07 14:26 ` Vibhav Pant
2017-02-07 16:14 ` Eli Zaretskii
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=87mvdcfffg.fsf@pellet \
--to=eric@ericabrahamsen.net \
--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.