unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: James Thomas <jimjoe@gmx.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Improve Malayalam language transliteration
Date: Thu, 16 Jul 2020 09:07:30 +0530	[thread overview]
Message-ID: <87v9io9ll1.fsf@Kittu.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <83tuy8lulp.fsf@gnu.org>

Eli Zaretskii <eliz@gnu.org> writes:

> Why do you think lists are more expensive than strings in this case.

These are constants in the code, and I reasoned that a (contiguous)
string representation would use less memory and be easier to lookup.

The only reason I didn't think of this at first was that char-tables in
indian.el & ind-util.el used lists rather than vectors, but I don't know
why, honestly.

> Did you have a chance to measure the performance and saw a significant
> difference?

I have done it now by running this 5 times in succession:
./emacs -Q --batch --eval '(progn (set-input-method "malayalam-mozhi") (message "%s %s" (benchmark-run 1000 (self-insert-command ?U) (self-insert-command ?L)) (memory-use-counts)))'

For benchmark-run:

Before:
(0.0038055209999999996 0 0.0)
(0.0037328350000000003 0 0.0)
(0.003799021 0 0.0)
(0.0038411929999999997 0 0.0)
(0.003767182 0 0.0)
After:
(0.00391531 0 0.0)
(0.003733149 0 0.0)
(0.0037935509999999996 0 0.0)
(0.003811992 0 0.0)
(0.0038083170000000003 0 0.0)

Seems to be either no improvement or a slight degradation in timings...

For memory-use-counts:

Before:
(2237361 649 4075372 17010 1612818 4995 86731)
After:
(2237339 649 4075373 17010 1612855 4995 86734)

Note the difference in conses (1st item), vector cells (3rd),
string-chars (5th) and strings (last). Accounting for their unit sizes
the benefit is:
(2237361-2237339)*16+(4075372-4075373)*16+(1612818-1612855)*1+(86731-86734)*32
=203 bytes

Not sure if this is significant. I'll defer to your judgement...



  reply	other threads:[~2020-07-16  3:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26 13:49 [PATCH] Improve Malayalam language transliteration James Thomas
2020-04-26 15:43 ` Eli Zaretskii
     [not found]   ` <87tv161aml.fsf@gmx.net>
2020-04-26 17:12     ` Eli Zaretskii
2020-04-26 22:11       ` James Thomas
2020-04-27  1:33       ` James Thomas
2020-04-27  2:42       ` James Thomas
2020-05-28 17:33         ` Eli Zaretskii
2020-05-29 14:57           ` James Thomas
2020-06-01  8:49           ` James Thomas
2020-06-01 15:02             ` Eli Zaretskii
2020-06-02  2:27               ` James Thomas
2020-07-15 12:11           ` James Thomas
2020-07-15 14:29             ` Eli Zaretskii
2020-07-16  3:37               ` James Thomas [this message]
2020-07-16  5:20                 ` James Thomas
2020-07-16  5:44                   ` James Thomas
2020-07-16 15:07                     ` 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=87v9io9ll1.fsf@Kittu.i-did-not-set--mail-host-address--so-tickle-me \
    --to=jimjoe@gmx.net \
    --cc=eliz@gnu.org \
    --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 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).