On 2013-01-07, at 2:39 AM, Josh Aas wrote:

> I was working on something for which TimeStamp and TimeDuration classes would 
> be helpful in simplifying code that deals with a cache expiration date. This 
> code does not require high-precision timing. In review I was told that 
> "TimeStamp shouldn't be used unless a hi-precision ms resolution is needed", 
> and that TimeStamp was particularly expensive on Windows due to the use of 
> QueryPerfomanceCounter.
> 
> TimeStamp doesn't seem to have been created with a heavy speed for accuracy 
> tradeoff in mind. Is this true?

TimeStamp is designed to be both very fast and very accurate. Unfortunately, 
the the Windows timing APIs are somewhat of a disaster which makes it very
difficult to achieve this (Bug 676349)

> If so, should there be a less expensive way to use it, such as an option or 
> default for lower accuracy?

Probably. I'd suggest adding a TimeStamp::LowResNow() as an alias for Now() and 
filing a bug about getting a cheaper implementation of that function on 
Windows. FWIW, Chrome has something similar to this as well.

-Jeff
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to