Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Make accessing time.self a bit more ergonomic... #19

Open
rwjblue opened this issue Feb 4, 2017 · 2 comments
Open

Make accessing time.self a bit more ergonomic... #19

rwjblue opened this issue Feb 4, 2017 · 2 comments

Comments

@rwjblue
Copy link
Contributor

rwjblue commented Feb 4, 2017

As far as I can tell, the only (non-underscored) way to get a given nodes self time is something like:

function selfTime(node) {
  for (let [statName, value] of node.statsIterator()) {
    if (statName === 'time.self') {
      return value;
    }
  }
}

Which is actually pretty annoying if all you need is the self time...

I do not have a specific API in mind, but I feel like we can come up with something better.

@rwjblue
Copy link
Contributor Author

rwjblue commented Feb 4, 2017

One suggestion would be something like (which basically just emulates the underlying data structure):

node.stats.time.self

Another idea is something like:

node.getStat('time.self');

Likely many other possibilities too...

@hjdivad
Copy link
Collaborator

hjdivad commented Feb 8, 2017

Yes. The motivation for the iterators is as primitives upon which something better can be built, but which also serve as an escape valve when the nicer API misses cases. I think we may want to implement (more efficiently) things similar to what we did in the spike, with sumStat, groupBy &c.

Stef had a spike at one point that was chainable which is likely nice for building up a plan and then executing it efficiently (so we don't have to iterate the graph repeatedly).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants