emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Improve Malayalam language transliteration


From: James Thomas
Subject: Re: [PATCH] Improve Malayalam language transliteration
Date: Thu, 16 Jul 2020 09:07:30 +0530

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 via email to

[Prev in Thread] Current Thread [Next in Thread]