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

Reduce garbage collection frequency #71

Open
colinmeinke opened this issue Jul 26, 2017 · 7 comments
Open

Reduce garbage collection frequency #71

colinmeinke opened this issue Jul 26, 2017 · 7 comments

Comments

@colinmeinke
Copy link
Owner

How is Wilderness handling memory? FPS? What are the bottlenecks? What improvements can be made?

@dalisoft
Copy link

FPS works nice, but memory can be optimized via reducing objects count and prepare shape before starting tweeen

@colinmeinke
Copy link
Owner Author

colinmeinke commented Jul 30, 2017

Yes FPS seems okay on my macbook pro, but this simple example seems janky. It's potentially being garbage collected too regularly (9 times in 6 seconds?).

chrome timeline

@dalisoft
Copy link

Creating less objects, array slightly improves performance. Reusing arrays and objects, caching gives even better results

colinmeinke added a commit to colinmeinke/wilderness-dom-node that referenced this issue Sep 14, 2017
colinmeinke added a commit to colinmeinke/wilderness-core that referenced this issue Sep 14, 2017
colinmeinke added a commit that referenced this issue Sep 14, 2017
@colinmeinke
Copy link
Owner Author

I've made some good initial progress on reducing objects. Garbage collection frequency has halved in my tests.

There's still plenty more to do in core. One area specifically to improve is middleware. Currently every tweened value is output through every piece of enabled middleware. This is unnecessary. I will think of a better way to do this.

@colinmeinke colinmeinke changed the title Profile performance Reduce garbage collection frequency Sep 14, 2017
colinmeinke added a commit that referenced this issue Sep 15, 2017
@colinmeinke
Copy link
Owner Author

Another area to refactor is the event system. Even if there are no event subscriptions Wilderness calls events function on each tick of a timeline. This creates a couple of new objects.

I'm thinking of changing the API here so that event subscription can only happen at timeline creation.

const timelineFinishCallback = () => alert('timeline finished')

const shapeStartCallback = shapeName => {
  if (shapeName === 'SHAPE_1') {
    alert('shape 1 started')
  }
}

timeline(shape1, shape2, {
  events: [
    [ 'timeline.finish', timelineFinishCallback ],
    [ 'shape.start', shapeStartCallback ]
  ]
})

This way for timelines with no events (I assume this will be the majority), there will be zero overhead from the event system.

colinmeinke added a commit to colinmeinke/wilderness-core that referenced this issue Sep 17, 2017
colinmeinke added a commit to colinmeinke/wilderness-dom-node that referenced this issue Sep 17, 2017
colinmeinke added a commit to colinmeinke/wilderness-dom-node that referenced this issue Sep 17, 2017
@dalisoft
Copy link

The GSAP cannot be compared to this as this is free and available for anyone. That is matter for a lot of developers, newbies and others. Wilderness is free and enough fast to made smooth UI with morph. Maybe i wrong... Check out this https://www.npmjs.com/package/es6tween-plugin-morph maybe this is comparable because its free and based on points and svgpoints with some helpers. Also i build some morph that does from group to path or etc or vice versa. The es6tween morph plugin also not bad. Does group to group and path to any except group and so on.

@dalisoft
Copy link

About performance the last commits looks nice.

colinmeinke added a commit to colinmeinke/wilderness-core that referenced this issue Jan 14, 2019
change event api from pubsub to defined at timeline creation.

BREAKING CHANGE: Timeline event API change. See d11b036c635f33966f1a816b303ec128e88ae673. Also,
exports flushEvents function in place of events function.

Refs colinmeinke/wilderness#71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants