Skip to content

Batch compilation #2738

Open
Open

Description

@jkwchui

Description

Currently Typst work on one .typ at a time. Iterating through multiple files require calling typst compile programmatically, spinning up and down OS processes.

It may be desirable for typst compile or typst watch to accept as inputs either

  1. (nested) folders, or
  2. *.typ within a single directory

Use Case

When users have many files (I'm working on a project with batches of 50,000 .typ), it may be more performant to spin up compile or watch once instead of once-per-file.

Activity

  1. added
    feature request
    on Nov 22, 2023
  2. Enter-tainer commented on Nov 22, 2023

    @Enter-tainer
    Contributor

    maybe. for 50k files, 50k compilers would be launched and it might not have a performance gain because rust programs already have a very fast launch speed.

  3. ondohotola commented on Nov 22, 2023

    @ondohotola

    In the meantime, what about generating a master.typ which includes all and watch that?

  4. Myriad-Dreamin commented on Nov 22, 2023

    @Myriad-Dreamin
    Contributor

    rust programs already have a very fast launch speed.

    Some programs maybe, but not typst. The bottleneck is typst loading system fonts per task. From previous stats, if you run typst without extra fonts on Windows 11 (default fonts), it would take 50k * 100ms = 5000 secs to load font data (compilation time excluded).

  5. added
    cli
    on Nov 22, 2023
  6. jkwchui commented on Nov 23, 2023

    @jkwchui
    Author

    @ondohotola I get most right on the first shot, so compile is more frequent than watch. I don't think include can give me the outputs as separate files?

    @Myriad-Dreamin This is interesting to note. My files take an average of 15 ms to compile, so a single Typst launch instead of many would take the compile times down 80%.

  7. changed the title [-]Compile/Watch Folders or *.typ[/-] [+]Batch compilation[/+] on Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clifeature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions