Skip to content

Performance issues when quickly updating cubic bezier values #18

@kitschpatrol

Description

@kitschpatrol

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.

<script type="module">
  import * as Tweakpane from 'https://unpkg.com/tweakpane@4.0.1/dist/tweakpane.js';
  import * as EssentialsPlugin from 'https://unpkg.com/@tweakpane/plugin-essentials@0.2.0/dist/tweakpane-plugin-essentials.js';

  const pane = new Tweakpane.Pane({ title: 'Cubic Bezier Stress Test' });
  pane.registerPlugin(EssentialsPlugin);

  const bezierApi = pane.addBlade({
    view: 'cubicbezier',
    value: [0, 0, 0, 0],
  });

  setInterval(() => {
      bezierApi.value = new EssentialsPlugin.CubicBezier(
        Math.random(),
        Math.random(),
        Math.random(),
        Math.random()
      );
  }, 4);
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions