Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Myth? mdot always faster?
Message
De
16/04/2004 08:17:00
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00895232
Message ID:
00895493
Vues:
18
George,
m. is missing on the right side of expression < bg >
netdiff = withmdot - withoutm
Shouldn't it be :
netdiff = m.withmdot - m.withoutm

Honestly this is my #1 reason to use m. whenever possible rather than speed. VFP can use anyname as memvar.
Depending on table in use, mdot might catch up and even be much better than dotless version IMHO. I remember I showcased this with an exagarated table structure where it took ages for dotless version to complete. Include a property and things are worse :
this.myProperty
vs :
m.this.myProperty
o = Createobject('myTest')
m.o.doit()

Define Class myTest As Line
  myProperty = 5
  Procedure doit
     Create Cursor This (myProperty i)
     Insert Into This Values (1)
     Select 0
     ? This.myProperty
     ? m.this.myProperty
Endproc
Enddefine
PS: Using keywords as cursor/aliasnames is another story but say I already utilize 'update' command not making a difference between and alias and an objectname :)
Cetin


>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,
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform