Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Side by side comparison (strings & local data)
Message
De
28/12/2003 05:45:25
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
27/12/2003 14:32:45
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Divers
Thread ID:
00861648
Message ID:
00862324
Vues:
24
>>Hi all
>>
>>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:
>
>Here's the VFP program the way I'd write it:
>
LOCAL lcBigXML
>Close Databases all
>*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()
>Set Textmerge to memvar lcText noshow
>Set Textmerge delimiters to "{{","}}"
>Set Textmerge on
>\local lcXml
>\	lcXML ="<CLIENT>"
>	FOR f = 1 TO ALEN(laFields, 1)
>\		lcXML = lcXML + "<{{Alltrim(laFields(f, 1))}}>" + ;
>\			TRANSFORM(Test.{{Alltrim(laFields(f, 1))}}) +;
>\			"</{{Alltrim(laFields(f, 1))}}>"
>	ENDFOR
>\	lcXML = lcXML + "</CLIENT>"
>\return lcXml
>Set Textmerge to
>StrToFile(lcText, "runner.prg")
>Compile runner.prg
>lcBigXml="<TEST>"
>Scan
>	lcBigXml=lcBigXml+runner()
>ENDSCAN
>
>lcBigXML = lcBigXML + "</TEST>"
>
>*Show Time-Taken
>?SECONDS() - StartTime
>
>Now if you don't mind, compare this for speed.

Dragan,
I didn't mind to compare :) but was disappointed with the result :( It was the worst of all (not meaning the original code Kevin supplied) with a timing of 641 seconds !!!
This wasn't what I meant when I said "...used Dragan's approach in one of my needs and it speeds up..." in my reply to Nick.
I also took time to convert it to use fputs() instead of "lcBigXML = lcBigXML + ..." (which I always beleived to be the slowest). It at least caught the worst timing of C# with 69 seconds (directly from IDE Ctrl+F5).

With simple tests C# code provided might be beaten but it could be optimized too like we're doing to VFP versions (still if only data retrieving part is tested it's 3-5 times slower but that part doesn't count much on whole process).
Cetin
Ç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