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

Major garbage collection sweeps causing jank #9

Open
JonDum opened this issue Sep 11, 2018 · 1 comment
Open

Major garbage collection sweeps causing jank #9

JonDum opened this issue Sep 11, 2018 · 1 comment

Comments

@JonDum
Copy link

JonDum commented Sep 11, 2018

I'm noticing pretty bad GC sweeps every few seconds using a dozen or so springs.

I think the majority of this is coming from the object/closure oriented way springs are updated via updateConfig.

  updateConfig(updatedConfig: PartialSpringConfig): this {

    this._advanceSpringToTime(Date.now());

    const baseConfig = {
      fromValue: this._currentValue,
      initialVelocity: this._currentVelocity
    };

    this._config = {
      ...this._config,
      ...baseConfig,
      ...updatedConfig
    };

    this._reset();

    return this;
  }

https://github.com/skevy/wobble/blob/develop/src/index.ts#L152-L175

For reference, this SO answer details pretty nicely all the things that are going to allocate memory in js

I haven't looked too closely at _advanceSpringToTime yet, but I don't see any major culprits at first glance.

I like the minimalism of wobble and I'd like to submit some PRs if you want to discuss alternative syntax here first to avoid the {}'s.

@skevy
Copy link
Owner

skevy commented Sep 11, 2018

Hi @JonDum!. I would be happy to accept PRs. I don't have a lot of time to work on this right now myself, but I promise to be responsive with review!

As far as this issue and #8, I appreciate the bug reports and have no doubt that there are issues here.

I'll be on the lookout for PRs! :)

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