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

High CPU load after long time running #32

Closed
zenozeng opened this issue May 19, 2015 · 2 comments
Closed

High CPU load after long time running #32

zenozeng opened this issue May 19, 2015 · 2 comments
Assignees
Labels
Milestone

Comments

@zenozeng
Copy link
Owner

No description provided.

@zenozeng zenozeng added the bug label May 19, 2015
@zenozeng zenozeng self-assigned this May 19, 2015
@zenozeng zenozeng added this to the v0.6 milestone Aug 19, 2015
@zenozeng zenozeng modified the milestones: v0.7, v0.6 Jan 25, 2016
@ianisl
Copy link

ianisl commented Jan 13, 2018

Thanks a lot for this library, very useful!

I've started playing with some simple sketches and noticed a huge slowdown after a few seconds of use.

Saving the SVG and opening it in Illustrator, I noticed there was a huge number of nested nodes. It seems every call of p5.js' draw method adds a new g node as a child of the already existing g node inside the svg element created by p5.js-svg. In other words, every frame gets added to the DOM, although only the last one is visible.

A quick workaround is calling the __clearCanvas method of the Context at the beginning of p5.js' draw:

let renderer;

setup() {
  renderer = createCanvas(100, 100, SVG);
}

draw() {
  renderer.drawingContext.__clearCanvas();
  // Do the drawing
}

@zenozeng zenozeng added Doc and removed bug labels Jun 14, 2021
@zenozeng
Copy link
Owner Author

Thanks @ianisl

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

No branches or pull requests

2 participants