Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Myth? mdot always faster?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Myth? mdot always faster?
Divers
Thread ID:
00895232
Message ID:
00895232
Vues:
69
Given the number of posts regarding the use of the "mdot" prefix with objects such as "This", I decided to design a test to determine if this was always the case. My results are posted after the code that follows.

You should note that in order to assure that the test was as accurate as possible, I turned the screen saver off, as well as making VFP not visiable.

The tests were conducted using Windows XP Home SP1 with VFP 8.0 SP1 and run on a computer with an AMD Athon XP 2000+, with 512 Mb of RAM and 59 Gb of free disk space.
CREATE TABLE Mdot (emptyloop N(9, 6), withmdot N(9, 6),;
  withoutm N(9, 6), withfaster L, netdiff N(9, 6))
  
DEFINE CLASS MTest AS Custom 

  PROCEDURE TestMDot(tiouter AS Integer, tiinner AS Integer)
  
    LOCAL linner, liouter, ox, emptyloop, withmdot,;
      withoutm, withfaster, netdiff, lii, lij, lnstart,;
      lnstop
    _SCREEN.Visible = .F.
    liouter = tiouter
    linner = tiinner
    FOR lii = 1 TO liouter
      lnstart = SECONDS()
      FOR lij = 1 TO linner
      NEXT 
      lnstop = SECONDS()
      emptyloop = lnstop - lnstart
      ox = NULL
      lnstart = SECONDS()
      FOR lij = 1 TO linner
        ox = m.This
      NEXT 
      lnstop = SECONDS()
      withmdot = lnstop - lnstart
      ox = NULL
      lnstart = SECONDS()
      FOR lij = 1 TO linner
        ox = This
      NEXT 
      lnstop = SECONDS()
      withoutm = lnstop - lnstart
      withfaster = (withmdot < withoutm)
      netdiff = withmdot - withoutm
      IF liouter > 1 THEN
        APPEND BLANK 
        GATHER MEMVAR 
      ENDIF 
    NEXT 
    _SCREEN.Visible = .T.
  ENDPROC 
ENDDEFINE 

* This starts the tests
SET PROCEDURE TO MTest
oTest = CREATEOBJECT('MTest')
* Make sure that the code is in memory
oTest.TestMDot(1, 1)
* Run the test 10 times with a million iterations
oTest.TestMDot(10, 1000000)
The results were that, on average using "mdot" when referencing an existing obect was over 20% (20.7764%) slower.

First question: Can anyone here see where the test is weighted towards one result or the other?

Second question: Is there a way to make the results more accurate?

Third question: Does anyone see different result from the above code?

Please include the specifics as I have when responding, including operating system, version, memory, free disk space, and version of VFP.

Thanks,
George

Ubi caritas et amor, deus ibi est
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform