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

Efficiently adding to an existing SyntaxSet #562

Open
9999years opened this issue Dec 16, 2024 · 1 comment
Open

Efficiently adding to an existing SyntaxSet #562

9999years opened this issue Dec 16, 2024 · 1 comment

Comments

@9999years
Copy link

In Zola, there's a set of builtin syntax definitions and support for loading your own from a directory. To avoid re-linking all the contexts in the builtin syntax definitions, these two SyntaxSets are kept separate.

However, this means that if you write a new syntax definition, you can't reference or embed any syntax from builtin set (getzola/zola#1678). The naïve approach of loading the serialized dump of the SyntaxSet, calling into_builder(), adding the new syntaxes, and build()ing it again causes an 8x slowdown (getzola/zola#2738).

It would be really nice if it were possible to efficiently add to an existing syntax set.

@keith-hall
Copy link
Collaborator

To avoid re-linking all the contexts in the builtin syntax definitions, these two SyntaxSets are kept separate.

Perhaps it would be possible to do the re-linking and then dump the resulting syntax set, and only load that dump the next time? And only re-parse/dump when something changes in the user's custom syntax definition directory?

Otherwise I'm not sure how to make it more efficient to add to an existing syntax set...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants