Quote Originally Posted by The trick View Post
FYI, if you use VB_PredeclaredId = True then you have a small overhead because each access to an object translated to:
Code:
If cObj Is Nothing Then Set cObj = New cObj

Hmm, that's interesting. I suppose that's fine with me so long as the overhead is consistent.

-------------

Quote Originally Posted by wqweto View Post
I'm wondering if the performance optimization of caching cFreq is worth the whole class as the uncomplicated version can be implemented with a single function in a .bas file:
thinBasic Code:
  1. Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As Currency) As Long
  2. Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As Currency) As Long
  3.  
  4. Public Function TimerEx() As Double
  5.     Dim cFreq As Currency
  6.     Dim cValue As Currency
  7.     QueryPerformanceFrequency cFreq
  8.     QueryPerformanceCounter cValue
  9.     TimerEx = cValue / cFreq
  10. End Function
cheers,
</wqw>

And that's also an interesting question. I guess I'll have to use QueryPerformanceCounter and QueryPerformanceFrequency to test themselves. Shouldn't be difficult though.

----------

Taking both of the above together though, I suppose in an ideally optimized situation, we'd keep it all in a BAS module and also have an "InitTimerEx" call that was mandated before "TimerEx" was called. We could check in the "TimerEx" procedure, but, again, that'd be some unwanted overhead.

Maybe I'll take a closer look at this stuff later,
Elroy