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

Fix redundant puml processes #1360

Merged
merged 2 commits into from
Sep 20, 2020

Conversation

ang-zeyu
Copy link
Contributor

@ang-zeyu ang-zeyu commented Sep 20, 2020

What is the purpose of this pull request? (put "X" next to an item, remove the rest)

• [x] Other, please explain: performance

Fully fixes #1243
Follow up to #1245 (comment)

What is the rationale for this request?
The puml plugin generated-diagram-tracking is ineffective as the data structure is cleared during preRender, which is called per page.

Let's add a per site (re)generation plugin hook to solve this

What changes did you make? (Give an overview)

  • add beforeSiteGenerate hook
  • implement this for the puml plugin, properly tracking the generated puml diagrams

Testing instructions:
The number of jvms spawned should only be the total number of puml definitions

Proposed commit message: (wrap lines at 72 characters)
Fix redundant puml jvm processes

The puml plugin tracks generated puml images, and does not regenerate
them if the same image has already been generated.

However, the Set data structure that tracks this is cleared during each
call of the plugin preRender hook, which is called per page.
Multiple pages may reference the same diagram, making the tracking
ineffective.

Let's add a new plugin hook, beforeSiteGenerate, that is called during
initial site generation and site regeneration during live preview.
This allows plugins to maintain and clear state during site
(re)generation.

Let's implement this hook in the puml plugin, and clear the Set data
structure in it instead, which properly tracks the generated puml
images.

@ang-zeyu ang-zeyu added this to the v2.17.0 milestone Sep 20, 2020
@ang-zeyu ang-zeyu merged commit ba2541f into MarkBind:master Sep 20, 2020
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

Successfully merging this pull request may close these issues.

High CPU usage for building large sites
1 participant