all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Karl Fogel <kfogel@red-bean.com>
To: emacs-devel@gnu.org
Subject: Re: C and Emacs Lisp code parts
Date: Fri, 01 Jul 2016 10:14:20 -0500	[thread overview]
Message-ID: <874m89crw3.fsf@red-bean.com> (raw)
In-Reply-To: <vz1shvtmrty.fsf@gmail.com> (Andy Moreton's message of "Fri, 01 Jul 2016 14:05:29 +0100")

Andy Moreton <andrewjmoreton@gmail.com> writes:
>> On 01.07.2016 11:25, Eli Zaretskii wrote:
>>>
>>> So yes, we need numbers to make rational decisions about this.
>>
>> Sorry, but that's irrational. Compare doesn't need numbers. To compare
>> implementations in C an exec is needed - which doesn't exist yet. If written,
>> the reason basically is gone, because C will be faster - unless something went
>> wrong, which is a case for debugging rather than benchmarks.
>
>Eli is right. You believe that C is always faster, but most programmers'
>intuitions about performance are wrong.  Benchmarks and numbers give a
>more objective basis for making rational design decisions.

Yes, Eli is exactly right, and is being completely rational.

Andreas, for example:

Suppose 100 functions have been converted from C to Lisp.  Of those 100, say that 3 are responsible for 95% of the slowdown that resulted (resulted from the conversion of the group of 100, that is).  Meanwhile, the other 97 are only rarely called, or are never called in loops, whatever -- in other words, they are not responsible for much slowdown.

If you convert all 100 functions back to C, then you lose the maintainability advantages of having the innocent 97 in Lisp, for very little real gain; you could have gotten almost all the gain from just identifying the 3 important functions and converting only them.

That's why Eli's point about profiling first, and basing any decisions on the results, is so important.

The adage "C is faster" is not always correct in any case, as others here have pointed out.  But what I'm saying above is that, even if it *were* always true, it would still not be an argument for converting lots of functions back to C, or for avoiding converting more functions from C to Lisp.  You have to know *which* ones need to be in C.  Manual testing can maybe identify a few of those, and if you can perform such tests and identify some such functions, that would be great.  An even more general way to do it (with correspondingly greater up-front investment, of course) is a performance test suite.

But to just recommend that Emacs stop moving things from C to Lisp, or move things back to C, without knowing *which* things and why, is to make a recommendation too vague to guide anyone's actions.

Best regards,
-Karl



  reply	other threads:[~2016-07-01 15:14 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01  8:03 C and Emacs Lisp code parts Andreas Röhler
2016-07-01  8:13 ` Eli Zaretskii
2016-07-01  8:39   ` Andreas Röhler
2016-07-01  9:16     ` Alan Mackenzie
2016-07-01 12:07       ` Andreas Röhler
2016-07-01 13:04         ` Eli Zaretskii
2016-07-05 22:48           ` John Wiegley
2016-07-06  7:25             ` Andreas Röhler
2016-07-06  7:31               ` Andreas Röhler
2016-07-06 14:01               ` bug#14518: " Noam Postavsky
2016-07-06 14:52               ` Eli Zaretskii
2013-05-31  9:30                 ` bug#14518: abbrev edits - delay when saving Andreas Röhler
2013-06-01  3:01                   ` Leo Liu
2013-06-01  5:52                     ` Andreas Röhler
2013-06-05 10:11                     ` Andreas Röhler
2013-06-05 13:12                       ` Stefan Monnier
2013-06-05 17:02                         ` Glenn Morris
2013-06-05 17:20                           ` Andreas Röhler
2013-06-07  1:43                           ` Glenn Morris
2013-06-07  5:38                             ` Andreas Röhler
2013-06-07  7:13                               ` Glenn Morris
2013-06-07  7:41                                 ` Andreas Röhler
2016-07-06 15:44                   ` bug#14518: C and Emacs Lisp code parts Glenn Morris
2016-07-06 16:15                     ` Eli Zaretskii
2016-07-06 22:36                       ` John Wiegley
2016-07-07  7:33                         ` Andreas Röhler
2016-07-07 15:16                           ` Eli Zaretskii
2016-07-06 16:21                     ` Andreas Röhler
2016-07-06 16:37                       ` Eli Zaretskii
2016-07-06 17:27                         ` Andreas Röhler
2016-07-06 17:35                           ` Eli Zaretskii
2016-08-05 23:38                   ` bug#14518: Status: abbrev edits - delay when saving npostavs
2016-12-07 19:56                     ` Glenn Morris
2016-07-06 15:27               ` C and Emacs Lisp code parts Phillip Lord
2016-07-06 15:27               ` bug#14518: " Phillip Lord
2016-07-06  7:25             ` Andreas Röhler
2016-07-01  9:17     ` John Wiegley
2016-07-01 13:26       ` Andreas Röhler
2016-07-01  9:25     ` Eli Zaretskii
2016-07-01 12:25       ` Andreas Röhler
2016-07-01 13:01         ` Eli Zaretskii
2016-07-01 13:05         ` Andy Moreton
2016-07-01 15:14           ` Karl Fogel [this message]
2016-07-01 16:52             ` Andreas Röhler
2016-07-01 17:13               ` Eli Zaretskii
2016-07-01 17:36                 ` Andreas Röhler
2016-07-01 17:38                   ` Eli Zaretskii
2016-07-02 16:41                     ` Fabrice Popineau
2016-07-02 17:16                       ` Eli Zaretskii
2016-07-01 17:55                   ` Alan Mackenzie
2016-07-01 18:31                     ` Andreas Röhler
2016-07-01 18:57                       ` Alan Mackenzie
2016-07-01 20:04                         ` Andreas Röhler
2016-07-01 20:31                           ` Davis Herring
2016-07-02  6:34                             ` Andreas Röhler
2016-07-02 11:29                               ` Paul Eggert
2016-07-05 17:02                               ` Davis Herring
2016-07-05 19:35                                 ` Andreas Röhler
2016-07-02  6:32                           ` Eli Zaretskii
2016-07-02  7:01                             ` Andreas Röhler
2016-07-02  8:15                               ` Eli Zaretskii
2016-07-02  3:32 ` Tom Tromey
2016-07-02  3:42   ` Clément Pit--Claudel

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=874m89crw3.fsf@red-bean.com \
    --to=kfogel@red-bean.com \
    --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.