On Tuesday, February 19, 2013 5:07:34 PM UTC-8, Dave Camp wrote:
> A few of the SF-based and SF-visiting devtoolers (anton, harth, fitzgen,
> and I) had lunch with some ember.js developers (Yehuda Katz, Tom Dale, and
> Erik Bryn). I took very sparse notes, but here's what I remember of the
> discussion. Please chime in if you were there and I got something wrong or
> missed something.
>
> If one of these things falls in your area, could you please file the
> appropriate bugs and followup to the list?
>
> = Object Display/Remote Protocol Extension =
>
> The ember.js folks have a chrome devtools extension to customize display of
> ember.js objects for developers using the framework. We haven't gone down
> the road of SDK/API support yet, although it's one of the topics for the
> March 11th work week.
>
> Yehuda said he could give us a writeup about the kinds of things they want
> to be able to do to customize the tools to their framework, but we can also
> just look at their chrome addon for ideas.
The most important customization points are:
* Ability to filter out properties that reflect internals (in many libraries, this will amount to filtering properties beginning with _)
* Ability for getters and setters to be lazily computed and presented
* Ability to supply a property descriptor for a property that is used to present data. This would allow Ember (and Backbone, and Knockout, etc.) to present properties that are designed to be used with `get` as getters and use the getter UI that I described above.
* Ability to supply additional metadata that should be presented together with the properties. For example, Ember Data may want the ability to show model attributes and relationships, regardless of how they are actually represented in the object structure.
* Ability to represent an alternative object hierarchy. For example, Ember supports a mixin system (and other libraries support trait-like systems) that are flattened into the prototype hierarchy. Some hook that would allow the display of the prototype hierarchy to be controlled by code.
If there is interest, I could provide some straw-man APIs that would satisfy some of these requirements.
> = Memory Tools =
>
> In addition to the traditional problems of leaking/retaining excessive
> memory (which has a reasonable amount of tool support in chrome, and
> planned support in our tools), they've also run in to problems with
> generating excessive garbage, leading to gc churn. So in addition to plans
> we have for tools to help understand the object graph that is being
> retained, we need tools for understanding what *isn't* retained, what's
> being collected. This isn't a new problem - early versions of Firefox Sync
> had fairly serious problems with excess garbage. Diagnosing this can be
> tough, we should help out here.
Erik Bryn and Kris Selden, who do a lot of our performance work, are desperate for this feature :)
> = Native Code in the Profiler =
>
> Confirming what we've already mostly agreed on: they want to be able to
> look at a profile that contains native stacks. Limiting solely to js makes
> it tougher to blame slow platform code, and slow platform code means slow
> application code.
We mentioned that it may be nice for the native code to be representable as a single frame, so we can see that, for example, our code is calling indexOf and costing 10ms, but not have to worry exactly how indexOf is implemented.
> = Closure Optimization =
>
> JS VMs optimize closures if they can prove that the closed-over code won't
> access some members of the environment. This leads to a terrible debugging
> experience:
>
> var a = 1, b = 2;
> executeSoon(function() {
> console.log(a);
> debugger; // b won't be visible in the environment when this debugger
> statement is hit.
> });
>
> At the very minimum, we need to warn that b was optimized out, rather than
> just confusing developers that think they should be able to access b in
> that scope (this is filed as bug 841622). Ideally these optimizations
> wouldn't happen in debug mode, although there's a performance penalty
> there. This is filed as bug 841625.
We also mentioned that the same issue happens when `arguments` is optimized out.
I'm no VM guy, but one approach might be to treat every frame as though it contained
an explicit call to `eval` when the debugger is open (or perhaps for a whitelisted list
of domains including localhost).
> = Filtered Stacks =
>
> We talked about marking a library (ember.js, jquery, whatever) as a black
> box. Once marked as a black box, code from those libraries would be
> squished to a single stack frame, and step into/step out would skip frames
> in that library, etc.
>
> I think this would be pretty easy to do in the debug server, the trickiest
> part would probably be identifying which sources should get this
> treatment. Thoughts?
We would love this feature. In the future, it could also be nice to be able to
tag the filtered stacks with a particular name, and filter out only Ember but
not other internal details. This is not important for initial implementation.
> = Async Stacks =
>
> We've wanted this for awhile, hopefully there's a bug on file already that
> I can't find: Tracing asynchronous code sucks. When you call setTimeout
> or addEventListener, the debugger should note your current stack alongside
> that call. When you hit a breakpoint in that function, the debugger should
> be able to display the stack trace that led to the
> setTimeout/addEventListener/XHR/whatever being called.
>
> We should also let content scripts tag a given call point as worth
> capturing a stack for.
Straw man proposal:
function later() {
console.log("hi");
}
later.tagStack();
// this defers this code until after the remaining application code is called,
// but does not use the browser's async mechanisms, so built-in support
// for setTimeout, etc. would not be sufficient
Ember.run.once(later);