[AccessD] uSecond timing

Stuart McLachlan stuart at lexacorp.com.pg
Thu Sep 3 06:03:52 CDT 2020


I must admit, I've never used it in Access, I've never needed to test anything to that degree of 
precision.  But I regulary use queryperformancecounter in PBWin.   In fact I used it today 
doing comparisons on a function which is called repeatedly in an application.

Test whether two numbers are within a certain range of each other.  Comparing plain Basic 
code against an assembler routine.

(ABS(n1,n2) <= range)
versus
 ! mov eax, n1
  ! sub eax, n2
  ! jnc Compare
  ! neg eax
Compare:
  ! cmp eax, range
  ! jg ExitNow
  ! mov ret, -1
ExitNow:           

1000 iteration of the PB code  took about 4.7 microseconds
1000 iterations of the Assembler code took  about 5.5 microseconds.


> Hi John and Stuart
> 
> Here:
>  https://stackoverflow.com/a/199480/3527297
> 
> I noticed this comment, and - for most practical purposes - I think he
> has a point:
> 
> <quote>
> Still, if you're measuring performance in VBA, getting 1/100th of a
> second resolution is not bad. -- Invoking the timing calls alone could
> take a couple of ms. If the call is so fast that you need that much
> resolution to time it, you probably don't need performance data about
> that call. - BrainSlugs83 </quote>
> 
> /gustav
> 
> -----Oprindelig meddelelse-----
> Fra: AccessD <accessd-bounces at databaseadvisors.com> På vegne af Stuart
> McLachlan Sendt: 2. september 2020 23:31 Til: Access Developers
> discussion and problem solving <accessd at databaseadvisors.com> Emne:
> Re: [AccessD] uSecond timing
> 
> LongLong only works with 64bit VBA.  A lot of people are still using
> 32bit Office.
> 
> An alternative:using a UDT LongInteger
> 
> https://stackoverflow.com/questions/198409/how-do-you-test-running-tim
> e-of-vba-code
> 
> 
> 
> 
> On 2 Sep 2020 at 17:24, Gustav Brock via AccessD wrote:
> 
> > Hi John
> > 
> > To prevent the scaling up/down of Currency he suggests, why not use
> > Decimal which, in VBA, isn't buggy at all, or simply LongLong which
> > is a 64-bit integer?
> > 
> > Looking forward to your video. I always wonder where people find the
> > time to experiment with such things.
> > 
> > /gustav
> > 
> > ________________________________
> > Fra: AccessD <accessd-bounces at databaseadvisors.com> på vegne af John
> > Colby <jwcolby at gmail.com> Sendt: 2. september 2020 18:42 Til: Access
> > Developers discussion and problem solving
> > <accessd at databaseadvisors.com> Emne: [AccessD] uSecond timing
> > 
> > I got a class implemented to do uSecond timing as opposed to the
> > normal mSecond timing.
> > 
> > Based on;
> > 
> > https://rotchvba.wordpress.com/2016/12/12/a-high-resolution-timer-in
> > -v ba/
> > 
> > I am preparing to do my very first YouTube video ever.  I'm doing a
> > crash course on OBS Studio now.  Once I get the first video figured
> > out, then I hope to do one weekly or so.  About (what else) how to
> > do OOP in access. And the first lesson will use a timer class to
> > demonstrate why you would use a class and how to do so.
> > 
> > Ease us all into the subject. 
> > --
> > John W. Colby
> > Colby Consulting 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 





More information about the AccessD mailing list