I think I'm overthinking efficienty of a patch (#12781)

Scott Kostyshak skostysh at lyx.org
Wed May 24 14:10:16 UTC 2023


I'm reviewing the patch at this ticket:

  https://www.lyx.org/trac/ticket/12781

I like its feature and plan to commit it unless there's an objection. See the screenshot attached to the ticket to quickly understand the feature.

I had a question there about efficiency. Basically, for each function, if there does not exist an icon, a transparent icon is constructed in order to maintain correct alignment. I think it's kind of like using \phantom in LaTeX. My question is whether it's worth it to construct the placeholder icon once, rather than many times, since the placeholder icon does not depend on the function. My best guess is that I'm overthinking this and that it's not worth complicating the code and that the current patch is fine.

Out of curiosity, (even if it's decided above that efficiency is not a concern here), would it be reasonable to use std::call_once() here, as suggested in this answer: https://stackoverflow.com/a/24337463/1376404.

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/20230524/e2a530cd/attachment.asc>


More information about the lyx-devel mailing list