Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any way to speed this up
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
00980402
Message ID:
00980412
Vues:
27
This message has been marked as a message which has helped to the initial question of the thread.
I would run the coverage profiler to see which lines are consuming the most time, then start working from there. At least you will see how many hits each line had and the total time it took to execute the lines of code. Then, as Calvin would say, take out the slow parts. < bg >

>Hi everybody,
>
>I'm working on the search form. I first do requery of the view, then do some post-processing of this view to get all the needed data. The requery of the view takes less than a second. But the post-processing takes 20 seconds for a 115 records scan. I am looking for the ideas of optimizing the code bellow. I tried another variation of this code with appending records into the cursor and then replacing, but it took the same amount of time. May be you can see what can I improve?
>
>
>*---------------------- Location Section ------------------------
>*   Library: 	Aquicksearchbiz.vcx
>*   Class: 		Quicksearchobject
>*   Method: 	Createfinalresult()
>*----------------------- Usage Section --------------------------
>*)  Description:
>*)
>
>*   Scope:      Public
>*   Parameters:
>*$  Usage:
>*$
>*   Returns:
>*--------------------- Maintenance Section ----------------------
>*   Change Log:
>*       CREATED 	01/24/2005 - NN
>*		MODIFIED
>*----------------------------------------------------------------
>LOCAL lnReccount, loSelect, cStatus, cUserID, lnSeconds
>lnSeconds = SECONDS()
>SET TALK OFF
>SET NOTIFY OFF
>
>WITH THIS
>	loSelect = .SelectAlias()
>	SCAN
>		IF VARTYPE(m.plStop) = "L" AND m.plStop
>			.EmptySearchResult() && Search was cancelled
>			EXIT
>		ELSE
>
>			.cTrans_FK = cTrans_PK
>
>				.REQUERY(.T.,"v_Commissioned_Owner")
>			** Let's do by VFP commands to avoid overhead
>			
>*!*				vp_cTrans_FK = cTrans_Pk
>*!*				REQUERY("v_Commissioned_Owner")
>			
>			cUserID = v_Commissioned_Owner.cUserID
>
>* cStatus field is either status description or resolution description if the resolution code is not empty
>			IF EMPTY(cResolution_Codes_Fk) OR ISNULL(cResolution_Codes_Fk)
>				.cViscodes_pk = cStatus_Codes_FK
>*				vp_cViscodes_pk = cStatus_Codes_FK
>			ELSE
>				.cViscodes_pk = cResolution_Codes_Fk
>*				vp_cViscodes_pk = cResolution_Codes_Fk
>			ENDIF
>
>			.REQUERY(.T.,"v_VisCodes_Lookup")
>*            REQUERY("v_VisCodes_Lookup")
>			cStatus = v_VisCodes_Lookup.cCode_Description
>
>			SCATTER MEMVAR
>
>			SELECT c_QuickSearch
>
>			INSERT INTO c_QuickSearch FROM MEMVAR
>		ENDIF
>	ENDSCAN
>	GO TOP IN c_QuickSearch
>ENDWITH
>
>lnReccount = RECCOUNT("c_QuickSearch")
>=MESSAGEBOX("Populating cursor took " + TRANSFORM(SECONDS() - m.lnSeconds) + " seconds")
>RETURN m.lnReccount
>
>
>Thanks in advance.
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform