GNU bug report logs - #47712
27.1; Provide `string-display-width` function, which takes properties into account, `substring-width`

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Sun, 11 Apr 2021 21:17:02 UTC

Severity: normal

Found in version 27.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #38 received at 47712 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Mendler <mail <at> daniel-mendler.de>
Cc: 47712 <at> debbugs.gnu.org
Subject: Re: bug#47712: 27.1; Provide `string-display-width` function, which
 takes properties into account, `substring-width`
Date: Mon, 12 Apr 2021 17:15:17 +0300
> Cc: 47712 <at> debbugs.gnu.org
> From: Daniel Mendler <mail <at> daniel-mendler.de>
> Date: Mon, 12 Apr 2021 16:05:41 +0200
> 
> I gave it a quick test. See the function `string-pixel-width` below. It 
> seems that it does not take 'invisible and 'display into account. I 
> probably have to change something to ensure that the properties are not 
> ignored.

If these properties are ignored, they will also be ignored on display.

> But for we can still look at the micro benchmark.  The `string-width` 
> function is 200 times faster than the `string-pixel-width` function. 

And if you reuse the same temp buffer?

> I am still not happy with replacing `string-width` with something so 
> much slower.

With 0.5 millisecond per call, I don't see a problem.  And I expect
that to go down if the buffer is reused.

> (defmacro bench (&rest body)
>    (let ((start (make-symbol "t")))
>      `(let (,start)
>         (setq ,start (current-time))
>         ,@body
>         (float-time (time-since ,start)))))

Please use benchmark-run, as that also tells us about GC during the
run, and important aspect.




This bug report was last modified 4 years and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.