Skip to content

Dramatic pagination performance reduction when creating TOC with page numbers #1652

@depth42

Description

@depth42

Describe the bug
I am working on a user manual with more than 100 pages which gets paginated with vivliostyle. Without a table of contents, the pagination is complete in under 10 seconds in Safari on my Mac Studio. When I activate the TOC, the pagination performance dramatically degrades and it takes 40 seconds to paginate. This smells like an unwanted O(n^2) behaviour somewhere in vivliostyle.

To Reproduce
Paginate the attached user manual "Manual.html" with vivliostyle v2.40.0 and measure the time.

By default, the TOC is active. If you want to disable it for speed comparison, add style="display:none" to the TOC div in line 57 of Manual.html.

TOCPerformance.zip

Expected behavior
Paginating with a TOC should not degrade the performance so much.

Desktop (please complete the following information):

  • OS: macOS 26.1
  • Browser Safari 26.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions