Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
REPLACE ALL, REPLACE ALL, REPLACE ALL, only 1st one work
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00404856
Message ID:
00406014
Views:
29
>Hi Nadya,
>
>I ran out of time and did not test REPLACE ALL vs. SCAN ... ENDSCAN. I never got REPLACE ALL to work in a repetitive fashion such as
>
>REPLACE ALL thisfield WITH X
>REPLACE ALL thatfield WITH X
>and so on ...
>
>I was told by someone that speed-wise they would be about the same, but I don't know if that is true. I am curious too.
>

Unless there's some hidden optimization going on in VFP's interpreter, that'd be hard to do - two statements means two separate passes at least through data in memory, even if the REPLACEs were fully optimizable. Try generating a huge garbage table by:
CREATE TABLE Gbg (cFld1 C(10), cFld2 C(10))
FOR i = 1 TO 2000000  && assumes you have 80MB free
   INSERT INTO GBG VALUES (SYS(2015), SYS(2015))
ENDFOR
Exit from VFP to flush all buffers, and reboot between runs to make sure that cache is excluded as an issue for initial start points. Run:

tStart = DATETIME()
REPLACE ALL cFld1 WITH SYS(2015), cFld2 WITH SYS(2015)
? DATETIME() - tStart

vs

tStart = DATETIME()
REPLACE ALL cFld1 WITH SYS(2015)
REPLACE ALL cFld2 WITH SYS(2015)
? DATETIME() - tStart
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform