Apologies, I got busy (I'm still trying to finish my tax reporting by the deadline) and forgot to make a post that the OP links are updated with revised gallery code. There will be a one-time lag while scrolling through the gallery for the first time at each game start but it's butter-smoother every time after that, even if you play in-game and later return to the gallery it's smooth. So expect the initial lag but only once per session. This occurs due to the way older RenPy renders the images before placing them into memory. Newer RenPy handles this without a hitch (it's an old graphical rendering inefficiency that PyTom fixed in later RenPy releases). But enough of me talking shop, I just wanted to let y'all know basically why those issues are a thing.
You'll know you are using the newest gallery as I decided to go with 4 columns instead of 3. Regards.