all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Barry Margolin <barmar@alum.mit.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: Knowing where a function has been used (bis) [Was: Re: Optimising Elisp code]
Date: Thu, 11 Oct 2018 15:29:03 -0400	[thread overview]
Message-ID: <barmar-457667.15290311102018@reader.eternal-september.org> (raw)
In-Reply-To: 86woqprcdb.fsf@zoho.com

In article <86woqprcdb.fsf@zoho.com>, Emanuel Berg <moasen@zoho.com> 
wrote:

> Barry Margolin wrote:
> 
> >> If we are talking the insanely long
> >> functions of Gnus, if the funcall overhead
> >> is the reason for that, I don't see why
> >> modularization plus inlining couldn't be one
> >> puzzle piece of the remedy.
> >
> > If a function is "insanely long" then
> > inlining will have negligible effect.
> > Funcall overhead is only relevant if the
> > function is really short, so it spends nearly
> > as much time calling the function as doing
> > the actual work of the function, AND you call
> > the function frequently enough that this
> > overhead adds up to something significant.
> 
> The insanely long functions would be shorter if
> they, instead of doing one million things,
> called other functions to help them with that.
> This isn't done because it isn't fast enough.
> But if inline works as you describe it, some of
> that code could in fact be moved out of the
> insanely long function, while still not slowing
> it down with funcall overhead.

Long functions are often long because of complex logic, which can be 
hard to extract into separate functions.

Also, we tend to extract code into separate functions only when there's 
some logic to it -- it has to have a meaningful identity outside the 
function where it exists. If a function can only be used in one place, 
and refers to lots of the variables in that caller, then it's often hard 
to justify splitting it out -- it actually makes things more confusing 
because the modularity doesn't make sense.

I doubt that anyone makes decision about whether to split large 
functions into separate functions based on the overhead of function 
calling.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


  reply	other threads:[~2018-10-11 19:29 UTC|newest]

Thread overview: 284+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05  2:15 Optimising Elisp code Davin Pearson
2018-10-05  2:19 ` Davin Pearson
2018-10-05  9:46   ` Emanuel Berg
2018-10-05 10:58   ` Noam Postavsky
2018-10-05 10:03 ` tomas
2018-10-05 14:28 ` Barry Margolin
2018-10-05 14:42   ` Emanuel Berg
2018-10-05 15:04     ` Emanuel Berg
2018-10-05 17:05       ` Óscar Fuentes
     [not found]       ` <mailman.1736.1538759161.1284.help-gnu-emacs@gnu.org>
2018-10-05 17:23         ` Emanuel Berg
2018-10-05 17:46           ` Óscar Fuentes
     [not found]           ` <mailman.1737.1538762057.1284.help-gnu-emacs@gnu.org>
2018-10-05 18:50             ` Emanuel Berg
2018-10-05 19:14               ` Emanuel Berg
2018-10-05 19:17                 ` Emanuel Berg
2018-10-05 19:26                 ` Emanuel Berg
2018-10-05 19:40           ` Stefan Monnier
     [not found]           ` <mailman.1741.1538768445.1284.help-gnu-emacs@gnu.org>
2018-10-05 21:55             ` Emanuel Berg
2018-10-05 18:04       ` James K. Lowden
2018-10-05 19:02         ` Emanuel Berg
2018-10-07  2:57     ` Barry Margolin
2018-10-06 10:45   ` Knowing where a function has been used (e.g. for optimizing) [Was: Re: Optimising Elisp code] Garreau, Alexandre
2018-10-06 14:40   ` Optimising Elisp code Stefan Monnier
2018-10-06 16:55     ` Garreau, Alexandre
2018-10-06 19:24       ` tomas
2018-10-06 19:55         ` Knowing where a function has been used (bis) [Was: Re: Optimising Elisp code] Garreau, Alexandre
2018-10-06 20:27           ` tomas
2018-10-06 21:42             ` Garreau, Alexandre
2018-10-07  8:10               ` tomas
2018-10-07 13:56                 ` Garreau, Alexandre
     [not found]               ` <mailman.1787.1538899813.1284.help-gnu-emacs@gnu.org>
2018-10-07 12:54                 ` Emanuel Berg
     [not found]           ` <mailman.1775.1538857674.1284.help-gnu-emacs@gnu.org>
2018-10-07 12:52             ` Emanuel Berg
2018-10-07 13:19               ` Stefan Monnier
     [not found]               ` <mailman.1792.1538918415.1284.help-gnu-emacs@gnu.org>
2018-10-07 15:59                 ` Emanuel Berg
2018-10-07 16:30                   ` Optimising Elisp code [again] Garreau, Alexandre
     [not found]                   ` <mailman.1805.1538929865.1284.help-gnu-emacs@gnu.org>
2018-10-08 14:11                     ` Emanuel Berg
2018-10-08 14:43                       ` tomas
     [not found]                       ` <mailman.1852.1539009893.1284.help-gnu-emacs@gnu.org>
2018-10-09  0:38                         ` Barry Margolin
2018-10-09  6:26                           ` Emanuel Berg
2018-10-09  8:07                             ` Garreau, Alexandre
     [not found]                             ` <mailman.1903.1539072429.1284.help-gnu-emacs@gnu.org>
2018-10-09 13:28                               ` Emanuel Berg
2018-10-09 15:03                                 ` Garreau, Alexandre
     [not found]                                 ` <mailman.1911.1539097442.1284.help-gnu-emacs@gnu.org>
2018-10-09 15:26                                   ` Emanuel Berg
2018-10-09 19:35                                     ` Garreau, Alexandre
2018-10-10 16:18                                     ` Barry Margolin
2018-10-10 20:53                                       ` Óscar Fuentes
2018-10-10 23:54                                       ` Garreau, Alexandre
     [not found]                                       ` <mailman.1975.1539205047.1284.help-gnu-emacs@gnu.org>
2018-10-11 18:10                                         ` Emanuel Berg
2018-10-12 19:52                                           ` Robert Thorpe
2018-10-07 16:10                 ` Knowing where a function has been used (bis) [Was: Re: Optimising Elisp code] Emanuel Berg
2018-10-07 16:35                   ` Garreau, Alexandre
2018-10-07 19:35                   ` Barry Margolin
2018-10-08 14:18                     ` Emanuel Berg
2018-10-08 15:23                       ` Garreau, Alexandre
2018-10-08 20:52                     ` Emanuel Berg
2018-10-09  0:41                       ` Barry Margolin
2018-10-09  6:35                         ` Emanuel Berg
2018-10-10 16:24                           ` Barry Margolin
2018-10-10 16:32                             ` Emanuel Berg
2018-10-11 19:29                               ` Barry Margolin [this message]
2018-10-11 20:05                                 ` Emanuel Berg
2018-10-12 22:32                                   ` Barry Margolin
2018-10-12 23:03                                     ` Eric Abrahamsen
2018-10-13 20:51                                     ` Emanuel Berg
2018-10-14  7:55                                       ` tomas
     [not found]                                       ` <mailman.2146.1539503732.1284.help-gnu-emacs@gnu.org>
2018-10-14 19:10                                         ` Emanuel Berg
2018-10-15  8:25                                           ` tomas
     [not found]                                           ` <mailman.2179.1539591977.1284.help-gnu-emacs@gnu.org>
2018-10-15 19:27                                             ` Emanuel Berg
2018-10-16  0:55                                               ` Van L
2018-10-17  0:20                                               ` Garreau, Alexandre
     [not found]                                               ` <mailman.2284.1539735662.1284.help-gnu-emacs@gnu.org>
2018-10-17  6:49                                                 ` Emanuel Berg
2018-10-10 20:50                             ` Óscar Fuentes
     [not found]                   ` <mailman.1806.1538930105.1284.help-gnu-emacs@gnu.org>
2018-10-08 14:14                     ` Emanuel Berg
2018-10-08 15:37                       ` Naming, and Gnus functions length [Was: Re: Knowing where a function has been used (bis) [Was: Re: Optimising Elisp code]] Garreau, Alexandre
     [not found]                       ` <mailman.1860.1539013068.1284.help-gnu-emacs@gnu.org>
2018-10-08 15:43                         ` Emanuel Berg
2018-10-08 15:52                           ` Naming, and Gnus functions length [ Garreau, Alexandre
     [not found]                           ` <mailman.1863.1539013974.1284.help-gnu-emacs@gnu.org>
2018-10-08 16:39                             ` Emanuel Berg
2018-10-08 20:03                           ` Naming, and Gnus functions length [Was: Re: Knowing where a function has been used (bis) [Was: Re: Optimising Elisp code]] Eli Zaretskii
     [not found]                           ` <mailman.1874.1539029031.1284.help-gnu-emacs@gnu.org>
2018-10-08 20:44                             ` Why is Elisp slow? (was: Re: Naming, and Gnus functions length [Was: Re: Knowing where a function has been used (bis) [Was: Re: Optimising Elisp code]]) Emanuel Berg
2018-10-08 23:53                               ` Why is Elisp slow? Garreau, Alexandre
2018-10-09 12:27                                 ` Stefan Monnier
     [not found]                               ` <mailman.1893.1539042845.1284.help-gnu-emacs@gnu.org>
2018-10-09  6:23                                 ` Emanuel Berg
2018-10-09  8:05                                   ` Garreau, Alexandre
2018-10-09 15:04                                     ` Eli Zaretskii
2019-05-02  4:49                                   ` Van L
2019-05-02  7:56                                     ` tomas
2019-05-02 11:06                                       ` Marcin Borkowski
2019-05-02 13:18                                         ` tomas
2019-05-02 15:34                                           ` Eli Zaretskii
2019-05-02 19:13                                             ` Marcin Borkowski
2019-05-02 19:45                                               ` Eli Zaretskii
2019-05-04 11:55                                                 ` Marcin Borkowski
2019-05-02 20:00                                               ` tomas
2019-05-04 11:52                                                 ` Marcin Borkowski
2019-05-02 19:33                                             ` Óscar Fuentes
2019-05-02 19:49                                               ` Eli Zaretskii
2019-05-02 20:12                                                 ` Óscar Fuentes
2019-05-02 20:20                                                   ` Eli Zaretskii
2019-05-02 21:40                                                     ` Ergus
2019-05-02 23:39                                                       ` 조성빈
2019-05-03  0:44                                                         ` Ergus
2019-05-03  1:06                                                           ` 조성빈
2019-05-03 10:36                                                             ` Ergus
2019-05-03 11:52                                                               ` 조성빈
2019-05-03 12:44                                                                 ` Eli Zaretskii
2019-05-03 12:58                                                                   ` Ergus
2019-05-03 14:00                                                                     ` Eli Zaretskii
2019-05-03 22:57                                                                     ` Stefan Monnier
2019-05-04 13:32                                                                       ` Ergus
2019-05-04 14:03                                                                         ` Stefan Monnier
2019-05-04 22:41                                                                           ` Emanuel Berg
2019-05-04 22:56                                                                             ` Stefan Monnier
2019-05-04 23:19                                                                               ` Emanuel Berg
2019-05-05 15:40                                                                                 ` Stefan Monnier
2019-05-06  6:53                                                                                 ` tomas
2019-05-06  8:25                                                                                   ` Emanuel Berg
2019-05-05  0:12                                                                               ` 조성빈
2019-05-05  3:15                                                                                 ` Stefan Monnier
2019-05-05  0:43                                                                           ` Ergus
2019-05-05  3:07                                                                             ` 조성빈
2019-05-05 15:50                                                                               ` Stefan Monnier
2019-05-06  7:33                                                                                 ` Tadeus Prastowo
2019-05-06  9:03                                                                                   ` 조성빈
2019-05-06 10:51                                                                                     ` Tadeus Prastowo
2019-05-06 12:58                                                                                 ` Ergus
2019-05-06 13:08                                                                                   ` Stefan Monnier
2019-05-06 16:17                                                                                     ` Ergus
2019-05-06 17:25                                                                                       ` Stefan Monnier
2019-05-06 17:45                                                                                         ` 조성빈
2019-05-06 18:08                                                                                           ` Stefan Monnier
2019-05-06 18:18                                                                                             ` 조성빈
2019-05-06 18:47                                                                                               ` Stefan Monnier
2019-05-06 20:23                                                                                                 ` Ergus
2019-05-06 20:41                                                                                                   ` 조성빈
2019-05-06 21:45                                                                                                 ` Jean-Christophe Helary
2019-05-06 22:03                                                                                                 ` Ergus
2019-05-06 23:07                                                                                                 ` Ergus
2019-05-07 10:49                                                                                                 ` Ergus
2019-05-07 11:51                                                                                                   ` 조성빈
2019-05-07 12:38                                                                                                     ` Ergus
2019-05-07 12:56                                                                                                     ` Stefan Monnier
2019-05-07 13:01                                                                                                       ` 조성빈
2019-05-07 13:04                                                                                                         ` Stefan Monnier
2019-05-07 13:14                                                                                                           ` Ergus
2019-05-07 13:43                                                                                                             ` 조성빈
2019-05-07 14:22                                                                                                               ` Stefan Monnier
2019-05-07 14:41                                                                                                                 ` Ergus
2019-05-09  9:49                                                                                                                 ` Ergus
2019-05-10  3:20                                                                                                                   ` 조성빈
2019-05-10  4:26                                                                                                                     ` Ergus
2019-05-10  4:35                                                                                                                       ` 조성빈
2019-05-10  8:27                                                                                                                       ` tomas
2019-05-07 13:16                                                                                                           ` 조성빈
2019-05-07 13:40                                                                                                             ` Ergus
2019-05-06 20:51                                                                                         ` Óscar Fuentes
2019-05-07  2:35                                                                                           ` 조성빈
2019-05-10  5:14                                                                                     ` Van L
2019-05-06 13:18                                                                                   ` 조성빈
2019-05-06 13:33                                                                                   ` Óscar Fuentes
2019-05-06 14:04                                                                                     ` 조성빈
2019-05-10  7:20                                                                                       ` Van L
2019-05-10 14:38                                                                                         ` Lisp, C, and C++ (was: Re: Why is Elisp slow?) Emanuel Berg
2019-05-10 14:49                                                                                           ` Emanuel Berg
2019-05-06 23:39                                                                                     ` Why is Elisp slow? Emanuel Berg
2019-05-05  5:25                                                                             ` Paul W. Rankin
2019-05-05 13:19                                                                               ` Óscar Fuentes
2019-05-05 13:46                                                                               ` Ergus
2019-05-06  7:01                                                                                 ` tomas
2019-05-05 12:51                                                                             ` Stefan Monnier
2019-05-10  3:15                                                                           ` Van L
2019-05-04 14:10                                                                         ` Eli Zaretskii
2019-05-03 12:51                                                                 ` Ergus
2019-05-03 13:16                                                                   ` 조성빈
2019-05-03 13:32                                                                     ` Ergus
2019-05-03 14:04                                                                     ` Eli Zaretskii
2019-05-04  0:32                                                                   ` Emanuel Berg
2019-05-04 11:29                                                                     ` Marcin Borkowski
2019-05-03  1:45                                                           ` Paul W. Rankin
2019-05-03  7:00                                                           ` Eli Zaretskii
2019-05-03  9:58                                                             ` Ergus
2019-05-03 12:41                                                               ` Eli Zaretskii
2019-05-03 22:18                                                               ` Óscar Fuentes
2019-05-04 13:27                                                                 ` Ergus
2019-05-04 13:38                                                                   ` 조성빈
2019-05-04  0:33                                                               ` Emanuel Berg
2019-05-03  7:08                                                           ` tomas
2019-05-10 13:14                                                           ` Van L
2019-05-10 13:22                                                             ` Michael Heerdegen
2019-05-10 14:44                                                               ` Emanuel Berg
2019-05-11  0:38                                                               ` Emanuel Berg
2019-05-11  1:55                                                                 ` Stefan Monnier
2019-05-11  2:16                                                                   ` Emanuel Berg
2019-05-11  7:32                                                                 ` Is Elisp really that slow? (was: Why is Elisp slow?) tomas
2019-05-11  7:42                                                                   ` 조성빈
2019-05-11  7:57                                                                     ` tomas
2019-05-11 14:30                                                                       ` 조성빈
2019-05-11 17:01                                                                         ` tomas
2019-05-11 23:09                                                                       ` Emanuel Berg
2019-05-12  7:54                                                                         ` tomas
2019-05-12  8:09                                                                           ` Emanuel Berg
2019-05-12  9:46                                                                           ` 조성빈
2019-05-12 14:21                                                                             ` Eli Zaretskii
2019-05-12 14:45                                                                               ` Is Elisp really that slow? Óscar Fuentes
2019-05-12 15:28                                                                                 ` Eli Zaretskii
2019-05-12 15:46                                                                                   ` Óscar Fuentes
2019-05-12 17:20                                                                                     ` Eli Zaretskii
2019-05-12 18:37                                                                                       ` Óscar Fuentes
2019-05-12 18:53                                                                                         ` Eli Zaretskii
2019-05-13  1:44                                                                                           ` Emanuel Berg
2019-05-12 21:18                                                                                         ` Stefan Monnier
2019-05-12 22:22                                                                                           ` Óscar Fuentes
2019-05-14 13:39                                                                                             ` Stefan Monnier
2019-05-14 15:09                                                                                               ` Óscar Fuentes
2019-05-13  0:57                                                                                           ` Samuel Wales
2019-05-13 12:37                                                                                             ` Stefan Monnier
2019-05-13 14:23                                                                                               ` Emanuel Berg
2019-05-13 14:33                                                                                               ` Emanuel Berg
2019-05-14  8:24                                                                                                 ` tomas
2019-05-14 13:21                                                                                                   ` Emanuel Berg
2019-05-14 14:44                                                                                                     ` tomas
2019-05-15 11:25                                                                                                       ` Emanuel Berg
2019-05-15 12:05                                                                                                         ` tomas
2019-05-15 23:02                                                                                                           ` Emanuel Berg
2019-05-16  6:48                                                                                                             ` tomas
2019-05-16  9:37                                                                                                               ` Noam Postavsky
2019-05-16 11:02                                                                                                                 ` tomas
2019-05-23 14:23                                                                                                                   ` Emanuel Berg
2019-05-24  1:33                                                                                                                     ` Van L
2019-05-16 13:31                                                                                                             ` Eli Zaretskii
2019-05-23 14:28                                                                                                               ` Emanuel Berg
2019-05-23 14:54                                                                                                                 ` Drew Adams
2019-05-23 14:55                                                                                                                 ` Eli Zaretskii
2019-06-06  5:18                                                                                                                   ` Emanuel Berg via help-gnu-emacs
2019-05-16 14:45                                                                                                         ` Stefan Monnier
2019-05-25  4:53                                                                                                           ` Emanuel Berg via help-gnu-emacs
2019-05-13  1:52                                                                                           ` Emanuel Berg
2019-05-13  1:35                                                                                         ` Emanuel Berg
2019-05-12 21:01                                                                                     ` Stefan Monnier
2019-05-13  1:27                                                                                   ` Emanuel Berg
2019-05-13 14:38                                                                                     ` Eli Zaretskii
2019-05-13 15:00                                                                                       ` Emanuel Berg
2019-05-13 15:25                                                                                         ` Eli Zaretskii
2019-05-14 11:54                                                                                           ` Emanuel Berg
2019-05-14 16:21                                                                                             ` Eli Zaretskii
2019-05-14 17:05                                                                                               ` Emanuel Berg
2019-05-14 18:30                                                                                                 ` Eli Zaretskii
2019-05-15 11:27                                                                                                   ` Emanuel Berg
2019-05-15 14:51                                                                                                     ` Eli Zaretskii
2019-05-16 23:19                                                                                                       ` Emanuel Berg
2019-05-17  6:41                                                                                                         ` Eli Zaretskii
2019-05-13 15:02                                                                                       ` John Yates
2019-05-13 15:14                                                                                         ` Eli Zaretskii
2019-05-13 22:40                                                                                       ` Dmitry Gutov
2019-05-14  6:27                                                                                       ` Paul W. Rankin
2019-05-14 13:10                                                                                         ` Emanuel Berg
2019-05-13 15:42                                                                                     ` Van L
2019-05-17 15:17                                                                                 ` Ken Goldman
2019-06-04  1:36                                                                                   ` Emanuel Berg via help-gnu-emacs
2019-05-24  4:28                                                                         ` Is Elisp really that slow? (was: Why is Elisp slow?) Xavier Maillard
2019-06-07 19:08                                                                           ` Emanuel Berg via help-gnu-emacs
2019-06-08  0:26                                                                   ` Samuel Wales
2019-06-08  0:30                                                                     ` Samuel Wales
2019-06-08  8:52                                                                     ` tomas
2019-06-08 21:00                                                                       ` Samuel Wales
2019-06-08 21:14                                                                         ` tomas
2019-06-08 21:44                                                                           ` Is Elisp really that slow? Óscar Fuentes
2019-06-08 23:29                                                                             ` Emanuel Berg via help-gnu-emacs
2019-06-11  4:10                                                                             ` Xavier Maillard
2019-06-09  6:46                                                                         ` Is Elisp really that slow? (was: Why is Elisp slow?) Eli Zaretskii
2019-06-11 20:23                                                                           ` Samuel Wales
2019-06-08 23:26                                                                       ` Emanuel Berg via help-gnu-emacs
2019-05-13  6:10                                                               ` Why is Elisp slow? Van L
2019-05-03  6:55                                                         ` Eli Zaretskii
2019-05-03  2:39                                                       ` Stefan Monnier
2019-05-03  6:51                                                         ` Eli Zaretskii
2019-05-02 19:10                                           ` Marcin Borkowski
2019-05-03 23:34                                         ` Samuel Wales
2019-05-04  6:19                                           ` Eli Zaretskii
     [not found]         ` <mailman.1772.1538855722.1284.help-gnu-emacs@gnu.org>
2018-10-07 12:45           ` Knowing where a function has been used (bis) [Was: Re: Optimising Elisp code] Emanuel Berg
     [not found]   ` <mailman.1752.1538822765.1284.help-gnu-emacs@gnu.org>
2018-10-07 12:41     ` Knowing where a function has been used (e.g. for optimizing) " Emanuel Berg
2018-10-07 13:46       ` Getting functions usage examples [Was: Re: Knowing where a function has been used (e.g. for optimizing) [Was: Re: Optimising Elisp code]] Garreau, Alexandre
2018-10-08  0:07         ` Van L
2018-10-08 15:40           ` Getting functions usage examples [ Garreau, Alexandre
2018-10-09  9:33             ` Van L
     [not found]       ` <mailman.1798.1538920786.1284.help-gnu-emacs@gnu.org>
2018-10-07 15:38         ` Getting functions usage examples [Was: Re: Knowing where a function has been used (e.g. for optimizing) [Was: Re: Optimising Elisp code]] Emanuel Berg

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=barmar-457667.15290311102018@reader.eternal-september.org \
    --to=barmar@alum.mit.edu \
    --cc=help-gnu-emacs@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.