Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache compiled document #503

Open
jamesrswift opened this issue Dec 3, 2024 · 6 comments
Open

Cache compiled document #503

jamesrswift opened this issue Dec 3, 2024 · 6 comments
Labels
feature request New feature or request. perf Performance problems.

Comments

@jamesrswift
Copy link

Description

Large documents, when first opened, can take a long amount of time to compile. It can be detrimental to motivation (ikr) to wait for the preview of a document you haven't even started to change yet. Could the final compile be cached somehow?

Use Case

Provides an immediate render of the document so you can more easily jump into editing. Perhaps this feature can be conditional on the time previously taken to compile?

@jamesrswift jamesrswift added the feature request New feature or request. label Dec 3, 2024
@laurmaedje
Copy link
Member

In the web app, it would be easier to do than locally because we can in theory save & restore a full memory snapshot, but it would use prohibitive amounts of storage.

@jamesrswift
Copy link
Author

A very fair criticism, for which I also do not see an easy way around. Would storing the state be a better option, so that the first compile is still a warm compile, perhaps?

@laurmaedje
Copy link
Member

Storing which state?

@jamesrswift
Copy link
Author

(Preface: I'm not overly familiar with Typst's internals) I thought that Typst keeps a store between compiles so that small changes lead to small compile times (incremental). Saving this when ending a session and restoring it when starting a new session, could be used to avoid a cold compile.

@Enivex
Copy link

Enivex commented Dec 3, 2024

Unless you have exceptionally fast storage and an exceptionally demanding document, compiling cold will be faster than compiling warm from a memory snapshot. Not to mention the gigabytes of storage required.

@laurmaedje
Copy link
Member

I thought that Typst keeps a store between compiles so that small changes lead to small compile times (incremental).

It does, but it's very hard to serialize this into bytes (it's full of pointers and in-memory data structures). Hence why storing a full memory snapshot is the only simple way. But either way, it'd be very large.

@laurmaedje laurmaedje added the perf Performance problems. label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request. perf Performance problems.
Projects
None yet
Development

No branches or pull requests

3 participants