-
Notifications
You must be signed in to change notification settings - Fork 216
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
Add Heimdall support #362
Add Heimdall support #362
Conversation
test/builder_test.js
Outdated
@@ -895,4 +900,113 @@ describe('Builder', function() { | |||
}); | |||
}); | |||
}); | |||
|
|||
describe('heimdall stats', function() { | |||
it('produces stats', function(done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let use mocha's built in promise support, rather then done
. This way, error handling is handled for us by default in tests.
This looks like:
it('foo', function() {
return promise.then(() => {});
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. Will do.
@stefanpenner any idea how we can get the nested data for heidmall. Seems like it needs to be: start(a) In order to make B a child of A. Currently the node event system does Start a |
broccoli 1.0 no longer evaluates nodes recursively. Rather it essentially top-sorts the plugin graph ahead of time, and produces a linear array of nodeWrappers, related code: Lines 144 to 146 in 7d97eba
This What I am saying, is. The new pattern in broccoli is much nicer, but it does lose the parent/child hierarchy we had before, and thus may require a difference. What likely could be done, is to emit as we do now. But ensure the |
Yes that was the conclusion I came to. I think adding the parent ids to the entry and reconstructing the recursive output would be a good idea. I also notice that in the broccoli-builder implementation, the total time for each node is the self time plus the sum of the inputs, which we should also preserve. This would mean iterating the heidmall tree from top down. I can work this out. |
@rwjblue can you confirm? This checks out for me. |
@oligriffiths also if at anypoint I'm blocking some aspect of broccoli work, feel free to pester me via any medium until I unblock you. |
@stefanpenner Super. Thanks |
Its a bummer we have to do this, but as part of this step I don't see a good option. I do believe as part of the 1x series, we will re-invest in heimdall, to make it and broccoli better friends. |
I actually find the current thing to be confusing because it makes the first parent look responsible for time it wasn't responsible for. |
@krisselden yeah I agreee. Heimdall is not able to properly model the broccoli graph. The fact that broccoli-builder would make “fake” nodes in order to satisfy shared plugins shows that the model is incorrect. Unfortunately heimdall would require a decent rewrite to support this, or something else entirely. |
Not sure why it would model the broccoli graph, Id rather put inputBroccoli ids alongside broccoliId. Heimdal represnts what you’d put into a flame chart. I hate that the visualizer now overweights the consuming node, it’s misleading. |
@krisselden a flame graph can’t accurately model a broccoli tree due to the fact that nodes are shared between inputs. Source nodes for example are reused. Even broccoli-builder had this same issue. |
This PR adds heimdall stats support to Broccoli master.
This is ported from https://github.com/ember-cli/broccoli-builder
I've tried to setup the test in as close a representation to the original as possible.
What we're doing is registering the
beginNode
andendNode
events to start/stop the heimdall timer, but these events are no longer "nested" as they are in Broccoli < 1.0. As a result, to get the nested structure that heimdall needs to do flame graphs, etc, we need to reconstruct this graph using the Broccoli node graph.Additionally, because Broccoli re-uses nodes (for source directories), and heimdall does NOT allow you to have a node with multiple parents, we're simulating a new heimdall node, in the same way as we're doing it in Broccoli < 1.0 https://github.com/ember-cli/broccoli-builder/blob/0-18-x/lib/builder.js#L101-L107 => https://github.com/broccolijs/broccoli/pull/362/files#diff-dde50c51d91de11d407f53423f3baeecR399]]]
Here's a vis output (running BROCCOLI_VIZ=1 ember build) for
broccoli 1.0
and currentmaster
for 2 builds:I used ember-cli/broccoli-builder#27 for the
broccoli-builder
branch as this makes the labels more informative and closer tobroccoli
(which I think is good).full
- a regular build of ember on a fresh applicationslim
- a simple build (2 nodes and a merge)Archive.zip
These can be uploaded to https://rwjblue.github.io/heimdalljs-visualizer
They produce the following results:
broccoli-full
:master-full
:broccoli-slim
:master-slim
:As you can see, both flame graphs are the same, and
broccoli-1
is slightly fasterNote
There appears to be a bug in the ordering of the output in the flame graph, looking into it...