Skip to content

glightbox exponentially slower with increase of the number of images #44

@PlasmaHH

Description

@PlasmaHH

I have a page with ~50 images and it takes forever to build. Just take some existing project and copy an image directive a lot of times to see for yourself.

I have stopped it in the debugger and it hangs in the regex sub of plugin.py around line 139 where it tries to do all the replacements in one go. I guess the look back/ahead of the regex there degenerates when it sees that many image tags.

maybe using the find_all in regexes and then looping over the matches works better?

PS: I think the re.compile in the function would benefit from being on the class level to only be ever executed once

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions