Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I'm loosing a VFP - VB battle
Message
From
08/03/2000 19:31:53
 
 
To
08/03/2000 16:03:55
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00342582
Message ID:
00343515
Views:
42
Nancy,

I speeded up you code:

* relative timings
*!*     Albert -        0.109
*!*     Albert -        0.125
*!*     Albert -        0.109
*!*     Albert -        0.109
*!*     Albert -        0.109
*!*     Albert -        0.109
*!*     Albert -        0.110
*!*     Albert -        0.110
*!*     Albert -        0.109
*!*     Albert -        0.109
*!*     Nancy -        0.297
*!*     Nancy -        0.281
*!*     Nancy -        0.297
*!*     Nancy -        0.296
*!*     Nancy -        0.297
*!*     Nancy -        0.328
*!*     Nancy -        0.281
*!*     Nancy -        0.282
*!*     Nancy -        0.296
*!*     Nancy -        0.297
set safety off
local vfCRLF, lc3CRs
vfCRLF = chr(13) + chr(10)
lc3CRs = chr(13) + chr(13) + chr(13)
Local lcSafety, lnSeconds, lcBrownAlums, lnTagStart, ;
     lcAlum, lnFirstQuote, lcURL, lnYearQuote, ;
     lcName, lcYear, lcSortYear, lcOutput
local array laTags[1]
local array laQuotes[1]
*!*     Set COVERAGE TO nf.txt
lnSeconds = SECONDS()
lcBrownAlums = FILETOSTR("BrownAlpha.html")
lcBrownAlums = chrtran(lcBrownAlums, chr(13), "")
lcBrownAlums = chrtran(lcBrownAlums, chr(10), "")
lnTagStart = AT("<UL>", lcBrownAlums)
lcBrownAlums = SUBSTR(lcBrownAlums, lnTagStart )
lcBrownAlums = strtran(lcBrownAlums, "<A HREF=", chr(13) + "<A HREF=")
lcBrownAlums = strtran(lcBrownAlums, "<AHREF=", chr(13) + "<A HREF=")
lcBrownAlums = strtran(lcBrownAlums, "</A>", "</A>" + chr(13))
*!* It's much faster to build the string, then write the file
*!*     Strtofile("<ALUMLIST>" + vfCRLF, "brown.xml")
lcFileStr = "<ALUMLIST>" + vfCRLF
for i = 1 to alines(laTags, lcBrownAlums)
     If laTags[i] = "<A HREF="
          laTags[i] = chrtran(laTags[i], '"><', lc3CRs)
          =alines(laQuotes, laTags[i])
          lcURL = laQuotes[3]
          lcName = laQuotes[4]
          laQuotes[4] = chrtran(laQuotes[4], "'", chr(13))
          =alines(laNameYear, laQuotes[4])
          If alines(laNameYear, laQuotes[4]) > 1
               lcYear = left(laNameYear[2], 2)
               lcSortYear = "19" + lcYear
               lcYear = "'" + lcYear
          Else
               lcYear = ''
               lcSortYear = ''
          Endif
          lcName = rtrim(laNameYear[1])
          lcFileStr = lcFileStr + "  <ALUM>" + vfCRLF + ;
               "    <NAME>" + lcName + "</NAME>" + vfCRLF + ;
               "    <SHOWYEAR>" + lcYear + "</SHOWYEAR>" + vfCRLF + ;
               "    <SORTYEAR>" + lcSortYear + "</SORTYEAR>" + vfCRLF + ;
               "    <URL>" + lcURL + "</URL>" + vfCRLF + ;
               "  </ALUM>" + vfCRLF
     Endif
Endfor
Strtofile(lcFileStr+"</ALUMLIST>", "browna.xml")
lnSeconds = SECONDS() - lnSeconds
=strtofile( "Albert - " + str(lnSeconds, 12, 3) + vfCRLF, "results.txt", .t. )
Release ALL
Clear ALL
*!*     Set COVERAGE TO
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform