title: Get current time from existing javascript Date() object?
body: <p>I am writing some debug code in a real-time javascript app. In the update loop, I want to:</p>
  
  <ol>
  <li>get current time in milliseconds
  <li>compare to last frame's time and print out framerate
  <li>set last frame's time to current time from the variable above
  </ol>
  
  <p>All straightforward, except that since it's in such a performance-critical piece of code, I'm trying not to call</p>
  
  <pre><code>var d=new Date();
  </code></pre>
  
  <p>every frame before I call</p>
  
  <pre><code>thisFrameTime = d.getTime();
  </code></pre>
  
  <p>Is this possible? Is there something along the lines of:</p>
  
  <pre><code>d.now
  </code></pre>
  
  <p>which updates the time in the existing date object?</p>
  
  <p>My thinking is that I want to stay away from memory allocation / gc while in debug mode so it impacts framerate less - but maybe that's just not how it's done in javascript? (My background is more C/C++, so maybe this is not the right way of thinking for JS?)</p>
  
  <p>I have searched Google and Stack Overflow, and can't seem to find an answer, which makes me think it's not possible. If that's the case, confirmation would be helpful.</p>
  
  <p>Would love any thoughts - what's the most performant way to get this done?</p>