From: Eli Zaretskii <eliz@gnu.org>
To: mattias.engdegard@gmail.com, Raffael Stocker <r.stocker@mnet-mail.de>
Cc: monnier@iro.umontreal.ca, 67536@debbugs.gnu.org
Subject: bug#67536: 29.1; Calc mode's math-read-preprocess-string conses unnecessarily
Date: Sat, 16 Dec 2023 11:40:21 +0200 [thread overview]
Message-ID: <83y1dumqnu.fsf@gnu.org> (raw)
In-Reply-To: <yplmttowphxa.fsf@mnet-mail.de> (message from Raffael Stocker on Tue, 05 Dec 2023 19:14:36 +0100)
Mattias, is this okay with you? Should I install these patches?
> From: Raffael Stocker <r.stocker@mnet-mail.de>
> Cc: Eli Zaretskii <eliz@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca>,
> 67536@debbugs.gnu.org
> Date: Tue, 05 Dec 2023 19:14:36 +0100
>
> Mattias Engdegård <mattias.engdegard@gmail.com> writes:
>
> > Here's a new patch.
> > A lot less pretty this time.
> >
> > In any case, make sure to include unit tests in your final patch.
>
> Ok, here it comes.
>
> I have constructed two org tables for the test (see test-input.org) that
> are reasonably long and contain a few not too unreasonable formulas.
> The nature of the formulas is not too important for the tests, I just
> took them from my original "offending" table.
>
> I also added unit tests for the function, as requested.
>
> One of the tables has no special characters, so
> ‘math-read-preprocess-string’ just has to walk through without doing any
> real work (arguably the most common case). The other table is full of
> replaceable stuff. I used these two tables to compare the original with
> the new version of ‘math-read-preprocess-string’. The results are in
> test-results.org.
>
> As before, I compared ‘gcs-done’ and ‘gc-elapsed’ (with standard
> settings for ‘gc-cons-threshold’ and ‘gc-cons-percentage’) with both
> versions and tables. I also instrumented ‘org-table-recalculate’ and
> ‘math-read-preprocess-string’ using elp. Then I set ‘gc-cons-threshold’
> to a large value and ran the same tests again. For the latter test, I
> only report ‘elp-results’ (as no GC was triggered).
>
> I recalculated every table three times per reported elp result, as it
> takes three evaluations for the calculation to converge.
>
> Some interesting results are:
>
> - time spent in GC reduces from 2.11 s to 0.78 s for the second table
> (with replacements)
> - elp report of average time decreases from 4.6316224e-3 s to
> 3.0294569e-4 s for the second table
> - with GC prevented, elp reports avg. time 3.4286452e-4 s vs. 4.9444e-5 s
> - elp report of elapsed time for ‘org-table-recalculate’ for three evaluations
> (what the user sees) decreases from 8.36 s to 4.11 s (with standard GC
> settings again)
>
> This is a real win especially for large tables. Needless to say, I am
> very excited about this optimization.
>
> (Just for completeness, I quickly compared my version to Mattias'
> version, the latter is about a factor of two faster according to elp.)
>
> Regards,
> Raffael
next prev parent reply other threads:[~2023-12-16 9:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 21:29 bug#67536: 29.1; Calc mode's math-read-preprocess-string conses unnecessarily Raffael Stocker
2023-11-30 7:00 ` Eli Zaretskii
2023-11-30 18:28 ` Raffael Stocker
2023-11-30 19:14 ` Eli Zaretskii
2023-12-01 17:34 ` Raffael Stocker
2023-12-01 18:12 ` Eli Zaretskii
2023-12-01 21:10 ` Raffael Stocker
2023-12-02 8:03 ` Eli Zaretskii
2023-12-02 14:56 ` Mattias Engdegård
2023-12-02 19:26 ` Raffael Stocker
2023-12-03 10:43 ` Mattias Engdegård
2023-12-03 11:13 ` Raffael Stocker
2023-12-03 11:58 ` Mattias Engdegård
2023-12-05 18:14 ` Raffael Stocker
2023-12-16 9:40 ` Eli Zaretskii [this message]
2023-12-18 10:55 ` Mattias Engdegård
2023-12-18 11:39 ` Raffael Stocker
2023-12-19 16:16 ` Mattias Engdegård
2023-12-19 17:09 ` Raffael Stocker
2023-12-19 18:15 ` Mattias Engdegård
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=83y1dumqnu.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=67536@debbugs.gnu.org \
--cc=mattias.engdegard@gmail.com \
--cc=monnier@iro.umontreal.ca \
--cc=r.stocker@mnet-mail.de \
/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).