Re: Graphics preview in parallel

Scott Kostyshak <[email protected]> Wed, 24 Jun 2026 13:28:15 +0200
Newsgroups gmane.editors.lyx.devel
Message-ID <aju9Mqx29Jy4yPEY@jimmy>
On Tue, Jun 23, 2026 at 03:52:12PM +0200, Pavel Sanda wrote:
> Hi all,
> 
> it's my long-term pain to wait for lyx loading the graphics when conversion
> chain is needed for the view. With longer reports with tons of images one has
> to wait while most of the cores are idling. Years back I created some patch
> to parallelize the preview chain, but it kept crashing for strange reason.
> 
> I looked into the issue again now with claude and have decent version which
> does not crash anymore. 

Great! I also have a patch that loads images in parallel that I have
been locally testing for a while. But I don't have a good understanding
and I just hacked things together. Yours seems well thought out.

> 1. The attached code triggers in parallel min(4, #of threads on your machine)
>    conversion chains and thus process the conversions fater. I kept the cap on 4 
>    so we don't overload the machine because of RAM.
>    Might slow initial load times on some machines.
>    I prefer it this way but I could see someone might not like it, objections?

I personally would like the option to be able to increase the threads.
But this can be figured out later.

> 2. I am introducing lfun which would trigger autoload of all previews. I found
>    myself regularly to scroll through the whole document, just that the load
>    process start and I dont have to wait later when working with the rest of
>    document. That's somewhat ridiculous. I do not propose to add this to UI
>    and keep it for power user who can bind it by shortcut.
> 
>    Completely different approach would be just autoload everything on start
>    by default, but I don't like that option - the preview can take on longer
>    documents quite a while and slows down all editation.
> 
>    It's in the second patch, and it does not interfere with the rest of the
>    codebase, so should be less controversial. Currently childern are included,
>    but I am thinking of striping that part.
>    Anyway are there some objections to include this lfun?

Not from me. I also find myself scrolling down just to trigger loading.

Not sure if related, but I also find it annoying that the scrollbar
length is not accurate. I don't like scrolling down and it gets
constantly readjusted as the document is loaded on-the-fly. I would
prefer an option to just have everything load at the beginning.

Okular has a nice "performance" tab of preferences. I attach a
screenshot.

Scott

-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel
okular.avif (image/avif, 15.8 KB) - not displayed
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEMfkICpsJzYuNuGlOA4ZnarZHC+sFAmo7v0oACgkQA4ZnarZH
C+t/wQf/R+/vTCeSj6YiFjBR2I+Dnwwfs6+PP9t1qcyw0+VsyqDV98Hg6n7C3iZG
CxtLgXqq9eJrUTLzpqbCdLLBf1LTs4QW57O4EgAUYacSJlgKS2+LphQrWrYtpPaj
UeteWKFxA5HnKQRFquNr/aXFaQhARYQCnbi0glYVM9AfJgFw7kJDxffRoaKa8yWP
5EvbSPe/W9stIhj7e+bgeFYlW7Atdvp1p5/pC2eAd44j+W9/pPreU51GwbSDw/+6
q6MyJTkra5i0nsxhuAKsEjGFFra8G4aqipLF08YMwTDBu7FdmGc+fyzkd1AjelbN
mTyiu/JuLmK3CLEkEELyf9TPfwXJOw==
=1Q+/
-----END PGP SIGNATURE-----