Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP versus C++
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00842594
Message ID:
00844543
Views:
16
[undo snip begin]
>>>The big question now is: Will C++ or Delphi do this job significantly faster??
>>>
>>>Yes. C++ is way much faster with string handling than Visual FoxPro. As I just prepare a session about writing FLLs I've finished a sample a couple of days ago that reverses a string. With 5 bytes, the C++ routine is a whopping 2% faster <g>, but when dealing with 50 KB strings, C++ was over 40000% faster. That is, a FoxPro routine that runs for 7 hours would finish in a minute in C++ code.
[undo snip end]

>>Could you send me the vfp routine and the time you expect? I also have c++ (visual studio 5), so maybe you could also send the c++ routine.
>
>You mean the FLL I used to test this and the VFP code? Sure.

I have tested your code and can confirm your 40,000 percent (400 times faster). Let us make public the VFP-routine. Perhaps someone comes up with a routine (native VFP code only!) that does the job significantly faster.
? "VFP, String 5 Bytes", Test_VFP(1)
? "VFP, String 50 KB", Test_VFP(10000)

Procedure Test_VFP (nFaktor)

   nAnzahl = 0
   nStart = Seconds()
   nDauer = 5
   lcStr = Replicate("Hallo",nFaktor)
	
   DO WHile nStart+5 > Seconds()
      nAnzahl = nAnzahl + 1 
      lc = ReverseVFP( lcStr )
   EndDo 

Return nAnzahl/nDauer

Procedure ReverseVFP
   Lparameters tcEingabe
   Local lnZeichen, lcAusgabe
   lcAusgabe = ""
   For lnZeichen = Len(m.tcEingabe) to 1 step -1
      lcAusgabe = lcAusgabe + Substr(m.tcEingabe,m.lnZeichen,1)
   EndFor 
Return m.lcAusgabe
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform