Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cast() is evaluated for every record
Message
From
09/09/2004 05:12:09
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Title:
Cast() is evaluated for every record
Miscellaneous
Thread ID:
00940524
Message ID:
00940524
Views:
65
On VFP the new CAST() function it will more become one of the functions used in SQL SELECT.

Sin that the Engine does not recognize the specificity of this function and that the reexecute the CAST for every record, degrading the performances.

A simple example, CAST a C(1) to a C(2):
*********

CLEAR
SET TALK OFF

CREATE CURSOR myCursor ( f1 C(1))

FOR K=1 TO 100000
INSERT INTO myCursor VALUES ('a')
NEXT

FOR K=1 TO 10000000
NEXT

T1=SECONDS()

SELECT CAST(F1 AS C(2) NULL) F2 INTO CURSOR R1 FROM myCursor

? 'TIME :',SECONDS()-T1
LIST STRUCTURE

T1=SECONDS()

SELECT CAST(F1 AS C(2) NULL) F2 INTO CURSOR R2 FROM myCursor WHERE .F.;
UNION ALL ;
SELECT F1 FROM myCursor

? 'TIME :',SECONDS()-T1
LIST STRUCTURE
The second it is twice more fast.

Fabio
Next
Reply
Map
View

Click here to load this message in the networking platform