Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Side by side comparison (strings & local data)
Message
 
 
À
23/12/2003 11:18:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Divers
Thread ID:
00861648
Message ID:
00861697
Vues:
29
I am disappointed. I was hoping to see two sets of tests one that compares string processing and the other a comparison of local data engines. Alas you appear to have tried doing both at the same time. More properly you appear to be comparing Evaluate( "Table." + cFieldname ) in Fox with indexed column access in C#. Why not just take an axe to FoxPro's legs and be done with it!

If you really want to do a reasonable comparison you need to do away with the inner field processing loop – since in 99% of cases we usually know beforehand what the field names are. You also need to report any steps you have taken to mitigate the effect of caching at Application, File System and OS levels.

>Just did a quick side-by-side comparison with C# and VFP8, the test is aimed at string building from local-data using ADO.Net & Fox's local data-engine, can anyone tell me if I've messed up in away or if there is a quicker way of doing this:
>
>Here's the VFP program:
>
>
>LOCAL lcXML
>lcXML = "<TEST>"
>
>*Start time
>SET DECIMALS TO 3
>
>USE C:\DEV\CSHARP\DEMO\DEMOS\DATA\CLIENT IN 0
>			
>SELECT * FROM Client WHERE UPPER(Cl_Sname) = "LAWRENCE" INTO CURSOR TEST NOFILTER
>
>=AFIELDS(laFields, "Test")
>
>StartTime = SECONDS()
>
>SCAN
>	lcXML = lcXML + "<CLIENT>"
>	FOR f = 1 TO ALEN(laFields, 1)
>		lcXML = lcXML + "<" + laFields(f, 1) + ">" + ;
>			TRANSFORM(EVALUATE("Test." + laFields(f, 1))) +;
>			"</" + laFields(f, 1) + ">"
>	ENDFOR
>	lcXML = lcXML + "</CLIENT>"
>ENDSCAN
>
>lcXML = lcXML + "</TEST>"
>
>*Show Time-Taken
>?SECONDS() - StartTime
>
>
>RESULT : Between 0.040 and 0.070 Seconds
>
>And here is the C# Version:
>
>
>public static void DataPerformance()
>	{
>	//Use Local FoxDB with lots of data
>	OleDbConnection Connection = new OleDbConnection(@"Provider=VFPOLEDB.1;Data Source=c:\dev\csharp\Demo\Demos\Data\Client.DBF") ;
>	OleDbDataAdapter Result = new OleDbDataAdapter("SELECT * FROM Client WHERE UPPER(Cl_Sname) = 'LAWRENCE'", Connection) ;
>	DataSet Cursor = new DataSet() ;
>	Result.Fill(Cursor, "CLIENT") ;
>	StringBuilder XML = new StringBuilder() ;
>	DataColumn[] Columns = new DataColumn[Cursor.Tables["Client"].Columns.Count];
>	Cursor.Tables["Client"].Columns.CopyTo(Columns, 0) ;
>
>	//Start time
>	DateTime StartTime = DateTime.Now;
>
>	XML.Append("<Test>") ;
>	//Build XML Result
>	//Scans through what would be a local-cursor in Fox
>	foreach (DataRow Row in Cursor.Tables["CLIENT"].Rows)
>	{
>	        XML.Append("<CLIENT>") ;
>		for (int c = 0; c < Columns.Length; c++)
>			{
>				XML.Append("<" + Columns[c].ColumnName + ">" + Row[Columns[c].ColumnName].ToString() +
>					"</" + Columns[c].ColumnName + ">") ;
>			}
>			XML.Append("</CLIENT>") ;
>		}
>
>	XML.Append("</Test>") ;
>
>	//End Time
>	DateTime EndTime = DateTime.Now ;
>
>	//End
>	Console.WriteLine(StartTime) ;
>	Console.WriteLine(EndTime) ;
>	Console.WriteLine(EndTime-StartTime) ;
>}
>
>
>RESULT : 0.0100143 Seconds
>
>It may not be a relevent test, I think it is, but let me know. The table in question has 55000 records and the SELECT statment extracts 55 of those. The aim is to demenstrate VFP using a local-cursor and C# using a local ADO.Net DataSet.
>
>Apologies for those who can't read C#.
>
>Thanks
censored.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform