-
Notifications
You must be signed in to change notification settings - Fork 6
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
Performance issues when quickly updating cubic bezier values #18
Comments
Thank you very much for looking into this — I've updated my browser since I opened the issue, and when re-testing today I'm not able to reproduce any memory accumulation either, so that doesn't seem to be the issue. I realize I should have explained why I was looking into a possible leak in the first place: I had observed frame rate slow-downs in tabs that have been open for a long time with regularly-updated CubicBezier controls. My memory leak hypothesis was wrong, apologies — but I investigated the issue a bit further today, and think I found the cause. If the time between setting the Tracking the animation frame ID and then cancelling the last Here's a video (of a very exaggerated scenario) that demonstrates the performance difference. The plugin-essentials version 0.2.1 is shown at left, and a fork with CubicBezier.Performance.Example.mp4Here's the test code. I'm using a bunch of blades to demonstrate the effect quickly, but even with a single blade the slowdown will eventually occur as long as the value update interval is < 1400ms. <script type="module">
import * as Tweakpane from "https://unpkg.com/[email protected]/dist/tweakpane.js";
import * as EssentialsPlugin from "https://unpkg.com/@tweakpane/[email protected]/dist/tweakpane-plugin-essentials.js";
const pane = new Tweakpane.Pane({ title: "Cubic Bezier Stress Test 2" });
pane.registerPlugin(EssentialsPlugin);
const fpsGraph = pane.addBlade({ view: "fpsgraph" });
const cbCount = 12;
const cbs = [];
for (let i = 0; i < cbCount; i++) {
cbs.push(
pane.addBlade({
view: "cubicbezier",
value: [0, 0, 0, 0],
picker: "inline",
expanded: true,
})
);
}
function render() {
fpsGraph.begin();
for (const cb of cbs) {
cb.value = new EssentialsPlugin.CubicBezier(
Math.random(),
Math.random(),
Math.random(),
Math.random()
);
}
fpsGraph.end();
requestAnimationFrame(render);
}
render();
</script> I'll re-title the issue to better reflect the observed behavior rather than a possible cause. |
Thank you for this superb library!
I noticed creeping memory usage when repeatedly setting the value of a
cubicbezier
blade.A minimal (but admittedly extreme) reproduction is something like this. After about five minutes, I see several hundred megabytes of usage in the tab.
Maybe
CubicBezier
value objects are being retained somewhere internally? Manually invoking GC helps a bit but still doesn't completely stop the accumulation.The text was updated successfully, but these errors were encountered: