- From: David Bruant <bruant.d@gmail.com>
- Date: Thu, 22 Aug 2013 22:30:30 +0200
- To: James Simonsen <simonjam@google.com>
- CC: Boris Zbarsky <bzbarsky@mit.edu>, public-web-perf <public-web-perf@w3.org>
- Message-ID: <521674E6.1060407@gmail.com>
Le 22/08/2013 20:37, James Simonsen a écrit : > On Wed, Aug 21, 2013 at 7:41 PM, Boris Zbarsky <bzbarsky@mit.edu > <mailto:bzbarsky@mit.edu>> wrote: > > This ambiguity seems like a hard blocker to actually proceeding > with our implementation. > > 2) It's not quite clear to me what the "contains a copy" language > means. Does this mean that this predicate: > > performance.getEntries()[0] == performance.getEntries()[0] > > tests false if getEntries returns a nonempty list? That is, each > time the list is returned it has to contain brand-new objects? If > this is in fact the intent, it's rather surprising; given that the > objects only have readonly properties it seems like it would be > better to return existing objects. If we _do_ want to return > brand-new objects every time, it seems like we should simply > return dictionaries instead: then we get the new-object behavior > for free and script gets non-magical objects to work with. > > > Blink doesn't create copies. It'd be silly to. I think we should just > update the spec. Maybe it should just be .entries, then (instead of .getEntries() )? I'm not sure I quite understand the difference between entryType and name. I'm not sure I see the benefit of the getEntriesByType and getEntriesByName methods since what they do can be done very easily in JS: var fooEntries = performance.entries.filter(function(e){return e.name === "foo"}) // ES5 var fooEntries = performance.entries.filter(e => e.name === "foo") // ES6 Also, let's show good practices in our examples so that devs learn how to write better JS: function measurePerf(){ if(window.console){ performance.entries.forEach(function(e){ console.group('perf entry '+ e.name); console.log('Entry Type:', e.entryType); console.log('Start Time:', e.startTime); console.log('Duration:', e.duration); console.groupEnd(); }) } } Thanks, David
Received on Thursday, 22 August 2013 20:31:00 UTC