Enter-tainer / typst-preview

[DEPRECATED] Use tinymist instead

Home Page:https://Enter-tainer.github.io/typst-preview/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Slowness when the document has a large table of contents

psads-git opened this issue · comments

This is just to report that preview gets notoriously slower when there is a large table of contents (generated by outline).

The reported slowness is not unacceptable, but maybe something can be done to improve the situation. Thanks!

can you show an example typ file that triggers the problem? this will help us diagnose the problem faster

Thanks, @Enter-tainer, for your reply.

The following code shows the issue:

#set heading(level:1, numbering: "1.")

#outline()

#for i in range(1, 100) {
  let s = [Section ] + [ ] + str(i)
  heading(s)
  lorem(120)
  for j in range(1, 20) {
    let s = [Subsection] + [ ] + str(j)
    heading(level: 2, s)
    lorem(250)
  }
}

The slowness is already observed in the masterproef thesis. It is caused by a typst outline element creating thousands of circles (the dots in the outline) in the page, and each circle results in many groups (<g/>) and bezier paths (<path/>). perhaps we don't have good solution. Rasterizing these dots is a way but very difficult.

to verify(and workaround) this, you may try redefine how outline is displayed -- and removing these dots. it should be faster

Yes, @Enter-tainer, I confirm that using

#outline(fill: none)

makes it faster!