[LyX/master] Do not run updateMacros if the buffer has not changed
Scott Kostyshak
skostysh at lyx.org
Fri Aug 30 12:27:17 UTC 2024
On Wed, Jul 24, 2024 at 04:31:59PM GMT, Jean-Marc Lasgouttes wrote:
> commit 999fb37ebb1aecfda9889fa6a2b2fbb15133f2aa
> Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
> Date: Sat Jul 20 22:31:34 2024 +0200
>
> Do not run updateMacros if the buffer has not changed
>
> Each buffer now has an id which is increased when it is marked dirty
> (or when one of its relatives is marked dirty).
>
> This can be a big win since updateMacros is very expensive.
> ---
[cut]
> +void Buffer::updateId()
> +{
> + ++d->id_;
> + for(Buffer * b : allRelatives())
> + ++(b->d->id_);
> +}
[cut]
I have a question only out of curiosity (it doesn't have any practical
consequence):
Also, is id_ ever updated by just 1 in updateId()? When I put debug code
to print id_, when I type I see:
id_: 0
id_: 2
id_: 4
id_: 6
id_: 8
id_: 10
id_: 12
id_: 14
id_: 16
id_: 18
I guess I'm wondering if there would be a problem if you just remove the
++d>id_ as follows:
void Buffer::updateId()
{
for(Buffer * b : allRelatives())
++(b->d->id_);
}
Or is there is a case where the relatives update won't update the
current buffer's id_?
Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20240830/611bc0a7/attachment.asc>
More information about the lyx-devel
mailing list