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

Fix shaping #181

Merged
merged 1 commit into from
Jul 20, 2016
Merged

Fix shaping #181

merged 1 commit into from
Jul 20, 2016

Conversation

chadhietala
Copy link
Collaborator

@chadhietala chadhietala commented Apr 17, 2016

Hmmm not really sure why the comments changed. Anyways, looks like there was much shape-shifting in this dude.
image

@krisselden or @stefanpenner can you review.

@@ -55,7 +63,7 @@ function getTransitionByIntent(intent, isIntermediate) {
}

// No-op. No need to create a new transition.
return new Transition(this);
return this.activeTransition || new Transition(this);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change doesn't appear to be shaping related.

Copy link
Collaborator Author

@chadhietala chadhietala Apr 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I don't know what is going on here. Was not intended. The even weirder thing is that it's only in the dist builds.

Copy link
Contributor

@jamesplease jamesplease Apr 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may already know this, but with some git magic you could fix this. If you...

  1. checked out a branch from master
  2. built and PR'd that
  3. came back here, reset the changes to dist
  4. rebased this PR off that other PR

...it would make few a cleaner diff here and more atomic commit history assuming the issue is what @stefanpenner suggested below

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmeas sounds reasonable, that way the diffs are cleaner when we have to do a bisect.
Unrelated to this PR, we should likely explore not committing built assets to the repo.

@stefanpenner
Copy link
Collaborator

Ah. Then maybe some of the last changes forget to publish dist

@@ -19,6 +19,13 @@ function Router(_options) {
this.delegate = options.delegate || this.delegate;
this.triggerEvent = options.triggerEvent || this.triggerEvent;
this.log = options.log || this.log;
this.dslCallBacks = []; // NOTE: set by Ember
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm...Ember-specific code in route-recognizer? 😕

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sounds like a short-term thing, ideally ember should track this state itself in ember-router instance, a sibling to router instance.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, cool.

@jamesplease
Copy link
Contributor

What's the reasoning for these updatez?

@chadhietala
Copy link
Collaborator Author

@jmeas It's important that you do not mutate the shape of the object post creation time. For each property on the object a hidden class is allocated for it. You should allocate these upfront so that the engine can optimize. The Transition class is probably the best example in this PR. If you create a Transition class and you only assign a portion of the fields you will end up with a hidden class layout table that looks like:

name offset
promise 0
error 1
params 2

Now if you create a new Transition class that has one more field we now you have to allocate a new hidden class as the layout table looks like the following.

name offset
promise 0
error 1
params 2
targetName 3

In comparison if you "slot" all of the fields up front you end up using the same hidden class for all instances instead of having an explosion of types. Below is an illustration of this, also you might find these articles interesting.

image

@jamesplease
Copy link
Contributor

Ah, okay, @chadhietala . I know a bit about V8 optimizations in regards to shaping – thanks for the detailed reply! ✌️

@rwjblue
Copy link
Collaborator

rwjblue commented Jul 14, 2016

@chadhietala - OK, I just updated dist, can you rebase and remove the changes to dist/ and only update the source files?

@rwjblue
Copy link
Collaborator

rwjblue commented Jul 20, 2016

Ping @chadhietala

@chadhietala
Copy link
Collaborator Author

Tis done.

@rwjblue rwjblue merged commit 9c0d537 into tildeio:master Jul 20, 2016
@rwjblue
Copy link
Collaborator

rwjblue commented Jul 20, 2016

Thanks @chadhietala!

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

Successfully merging this pull request may close these issues.

4 participants