[vtk-developers] vtkTimeStamp efficiency

Volpe, Christopher R (CRD) volpecr at crd.ge.com
Mon Oct 8 10:15:10 EDT 2001


> -----Original Message-----
> From: David Gobbi [mailto:dgobbi at irus.rri.ca]
> Sent: Saturday, October 06, 2001 11:30 PM
> To: vtk-developers at public.kitware.com
> Subject: [vtk-developers] vtkTimeStamp efficiency
> 
> 
> Hi all,
> 
> I've been looking through the Windows SDK docs, and it looks like
> vtkTimeStamp could be made significantly more efficient on Win32.
> 
> There is a Win32 API function called "long 
> InterlockedIncrement(long *)"
> that does specifically what we need, but is reportedly over 100X
> faster than the worst-case of the EnterCriticalSection() call that
> is currently done.

100x?? I certainly believe that about a mutex, which is what vtkTimeStamp used before I added
vtkCriticalSection, but I didn't think the latter was *that* expensive. However, yes I think
InterlockedIncrement would be better, and I could have sworn that there was some reason why I didn't
use that when I changed vtkTimeStamp last time, but I honestly can't remember what that reason was. 

> 
> The efficiency could also be improved by moving the body of
> vtkTimeStamp::Modified() into the .h file and making it an
> inline function.
> 
> Any objections to either of these changes?

Both sound good to me. 

-Chris



More information about the vtk-developers mailing list