unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: "T.V Raman" <raman@google.com>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Permanently fix org versioning breakage during builds?
Date: Mon, 25 Dec 2023 18:42:47 +0100	[thread overview]
Message-ID: <CALDnm50MVnvHSdj4gYCAVreJi7wV-jeGO+3ZoGLB01cq1JYofw@mail.gmail.com> (raw)
In-Reply-To: <87edfao035.fsf@localhost>

On Mon, Dec 25, 2023, 13:55 Ihor Radchenko <yantar92@posteo.net> wrote:

> I doubt that you are right about 99.9%, because I know that we have some
> macros (like `org-with-wide-buffer') that are utilized in
> performance-critical code - org-element-cache.

You want to bet on it? You really do believe the cost of an indirect funcall
outweighs multiple buffer allocations, plust whatever &rest body does?

(require 'cl-lib)

(defmacro joaot/progn (&rest body)
  `(progn ,@body))

(defmacro joaot/funcall (&rest body)
  `(joaot/with-funcall (lambda () ,@body)))

(defun joaot/with-funcall (fn) (funcall fn))
(when nil

(benchmark-run-compiled 100000 (joaot/progn (cons nil nil)))
;;(0.03082571 2 0.026723563000004447)
;;(0.030770479000000003 2 0.02662909699999716)
;;(0.030249778 2 0.02616808300000173)
;;(0.025063519000000003 2 0.021807326999997656)
;;(0.022791136 2 0.020065053000003275)

(benchmark-run-compiled 100000 (joaot/funcall (cons nil nil)))
;;(0.028634259999999998 2 0.02006373300000064)
;;(0.028718769 2 0.020229722999999922)
;;(0.02806812 2 0.020030715000004307)
;;(0.025772916 2 0.017697210000001462)
;;(0.026947274 2 0.018522359999998628)

(benchmark-run-compiled 100000 (joaot/progn (with-temp-buffer)))
;;(1.4586596770000002 179 1.2495902690000023)
;;(1.434278908 179 1.228926580999996)
;;(1.444412169 179 1.2385162100000002)
;;(1.445273846 179 1.2392989229999998)
;;(1.464507893 179 1.2581699959999995)

(benchmark-run-compiled 100000 (joaot/funcall (with-temp-buffer)))
;;(1.4344190810000002 179 1.223486917999999)
;;(1.418460156 179 1.211255973)
;;(1.449469906 179 1.232802902000003)
;;(1.419341703 179 1.2082177509999994)
;;(1.517436337 179 1.2952383430000012)

The time is completely dominated by allocation and
garbage collection.

A single cons allocation per macroexpansion is enough
to make the difference unmeasurable.  In fact, to be able
to measure it, you'll have to make body completely empty
and run it tens of milions of iterations to be able to measure
anything perceivable in the tenths of a second.

> And it is not the only concern why I do not feel that your suggestion is
> a good idea:
>
> - The problem with stale macros is not just Org mode's problem - it is
>   the problem with Elisp compiler machinery. A very hard one that is
>   non-trivial to solve.

It doesn't have a solution! It's just what macros give you: syntax
manipulation in exchange for late binding. You must add functions
back to regain Lisp's late binding and deal with Lisp's build systems
which don't usually let you specify dependencies between files.

> - The rest of Emacs just leaves the problem with macros as is and the
>   only reason why Org mode touched it is that it was simply a side
>   effect of how org-assert-version is implemented - it is first and
>   foremost aiming at handling the issue with multiple Org mode versions
>   being loaded at the same time, while the side effect of detecting
>   stale macros was a bonus.
>
> - Even if I solve the problem with macros using the technique you
>   proposed, the problem with mixed versions still has to be handled.

I've already explained that is a different other for people who use ELPA
& git to track bleeding edge.  It has another solution.  It's very confusing
to see you reject a solution to a given real problem just because it
doesn't solve another completely different one.

> - Further, fixing the stale macro problem means rewriting all the
>   existing, and, more importantly, future Org mode macros - an extra
>   maintenance burden which I am very hesitant to take.

So you'd rather bother everyone else with broken builds...
And what maintenance burden.  It's much easier to write macros
like this.  No hygiene concerns, no awkward ',foo' everywhere.

> - And that maintenance burden also comes with an additional downside of
>   potential performance degradation.

This bullet is a repeat / filler. Fallacious argument with no data.  I've given
you hard data. Read it.

> So, all-in-all, I do not see the idea with wrapped macros as something
> practical for Org mode.

I tried my best. Repeatedly in this argument you have made erroneous
statements and logically fallacies. And when I correct them, you just came
back whit some more. I have handed you a solution on a plate to fix a real
problem, and you drag your feet so it can stay "your solution".
Can't beat hubris.  Good luck.

João



  reply	other threads:[~2023-12-25 17:42 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22 17:27 Permanently fix org versioning breakage during builds? T.V Raman
2023-12-23 17:58 ` João Távora
2023-12-23 18:06   ` Ihor Radchenko
2023-12-23 18:44     ` João Távora
2023-12-24 11:50       ` Ihor Radchenko
2023-12-24 14:13         ` João Távora
2023-12-24 14:48           ` Ihor Radchenko
2023-12-24 16:32             ` João Távora
2023-12-24 16:36               ` T.V Raman
2023-12-24 17:00                 ` Eli Zaretskii
2023-12-24 17:04               ` João Távora
2023-12-24 17:16                 ` Ihor Radchenko
2023-12-24 17:48                   ` João Távora
2023-12-24 18:13                     ` T.V Raman
2023-12-24 18:52                       ` Eli Zaretskii
2023-12-24 18:13                     ` Ihor Radchenko
2023-12-24 23:11                       ` João Távora
2023-12-25 11:26                         ` &allow-other-keys + &rest body in cl-defmacro (was: Permanently fix org versioning breakage during builds?) Ihor Radchenko
2023-12-25 12:09                           ` João Távora
2023-12-25 12:21                             ` Ihor Radchenko
2023-12-25 19:00                           ` Ihor Radchenko
2023-12-25 13:58                         ` Permanently fix org versioning breakage during builds? Ihor Radchenko
2023-12-25 17:42                           ` João Távora [this message]
2023-12-25 18:24                             ` Ihor Radchenko
2023-12-24 17:05               ` Ihor Radchenko
2023-12-24 17:12                 ` João Távora
2023-12-24 17:18                   ` Ihor Radchenko
2023-12-24 17:24                     ` Ihor Radchenko
2023-12-24 17:54                       ` João Távora
2023-12-24 18:10                         ` Ihor Radchenko
2023-12-24 18:16                           ` João Távora
2023-12-24 18:23                             ` Ihor Radchenko
2023-12-24 18:47                           ` Eli Zaretskii
2023-12-24 18:56                             ` Ihor Radchenko
2023-12-24 18:57                               ` Eli Zaretskii
2023-12-24 18:42                         ` Eli Zaretskii
2023-12-24 14:56           ` Eli Zaretskii
2023-12-24 23:14             ` João Távora
2023-12-24  2:43     ` T.V Raman
2023-12-24  6:51       ` Eli Zaretskii
2023-12-24 16:29         ` T.V Raman
2023-12-24 16:56           ` Eli Zaretskii
2023-12-24 11:00       ` Ihor Radchenko
2023-12-24 12:32         ` Po Lu
2023-12-24 12:50           ` Ihor Radchenko
2023-12-24 12:57             ` Po Lu
2023-12-24 14:11             ` Stefan Kangas
2023-12-24 14:51               ` Ihor Radchenko
2023-12-24 14:58                 ` Eli Zaretskii
2023-12-24 16:59                   ` Ihor Radchenko
2023-12-24 17:26                     ` T.V Raman
2023-12-24 17:44                       ` Ihor Radchenko
2023-12-24 18:01                         ` João Távora
2023-12-24 18:12                           ` Ihor Radchenko
2023-12-24 18:16                             ` T.V Raman
2023-12-24 18:25                               ` Ihor Radchenko
2023-12-24 18:53                               ` Eli Zaretskii
2023-12-24 18:48                             ` Eli Zaretskii
2023-12-24 19:23                               ` Stefan Kangas
2023-12-24 18:45                           ` Eli Zaretskii
2023-12-24 18:11                         ` T.V Raman
2023-12-24 18:17                           ` Ihor Radchenko
2023-12-24 19:31                             ` T.V Raman
2023-12-24 18:51                           ` Eli Zaretskii
2023-12-24 17:56                       ` João Távora
2023-12-24 18:36                       ` Eli Zaretskii
2023-12-24 18:32                     ` Eli Zaretskii
2023-12-24 18:50                       ` Ihor Radchenko
2023-12-24 18:55                         ` Eli Zaretskii
2023-12-24 19:05                           ` Ihor Radchenko
2023-12-24 23:23                       ` João Távora
2023-12-24 19:16                     ` Stefan Kangas
2023-12-24 19:24                       ` Ihor Radchenko
2023-12-24 16:32               ` T.V Raman
2023-12-24 16:39                 ` João Távora
2023-12-24 16:58                   ` Eli Zaretskii
2023-12-24 17:05                     ` João Távora
2023-12-24 18:34                       ` Eli Zaretskii
2023-12-25 18:59             ` Ihor Radchenko
2023-12-25 19:27               ` Eli Zaretskii
2023-12-25 20:02                 ` Ihor Radchenko
2023-12-25 20:03                   ` 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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALDnm50MVnvHSdj4gYCAVreJi7wV-jeGO+3ZoGLB01cq1JYofw@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=raman@google.com \
    --cc=yantar92@posteo.net \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).