- From: Boris Zbarsky <bzbarsky@mit.edu>
- Date: Wed, 25 Nov 2015 17:08:11 -0500
- To: public-web-perf@w3.org
On 11/23/15 4:28 PM, Rajiv Tirumalareddy wrote: > I want to propose an API where a call to `performance.mark()` returns a > unique javascript object, lets call it a marker. And when I call > `performance.measure()` I should be able to pass to it two markers and > have it record the time between the markers. How is this different from: var firstObj = { mark: performance.now(); } .... var secondObj = { mark: performance.now(); } ... console.log(`Time passed: ${firstObj.mark - secondObj.mark}`); That is, if you just want something representing "the now point in time", performance.now() is it. The idea with mark() and measure() is so you don't have to cart around the time at which mark() was called to figure out how much time has passed when measure() is called. -Boris
Received on Wednesday, 25 November 2015 22:08:53 UTC