Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Slow detection of absent UNC
Message
De
16/11/2007 14:25:11
 
 
À
16/11/2007 13:40:12
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01269426
Message ID:
01269514
Vues:
21
It seems to make a difference which one you do first. If I do the DIRECTORY() first, it takes 6.75 seconds to fail and the Scripting object takes .003 seconds to fail. If I do the Scripting object first, it takes 4.5 seconds to fail and DIRECTORY() take .001.

So overall, you're right, it doesn't really speed it up that much. Windows must be caching the access. If I wait about 10 seconds between the tries, they both take their respective times to fail, so the Scripting object is faster, it's just not instant.


>Not even this one speeds up here.
>
>>Peter,
>>
>>If scripting is an option you might try GetFolder, in my test directory() takes between 5 and 10 seconds while getFolder takes just less than 0.02 seconds with the following code
>>
>>
>>clear
>>lcNotExistent		= '\\notexistent\notexistent\notexistent'
>>lcExistent		= '\\skyapps\apps\foxv\training'
>>
>>lnStart			= Seconds()
>>
>>? lcNotExistent, Directory(lcNotExistent), Seconds() - lnStart
>>
>>
>>lnStart			= Seconds()
>>? lcExistent, Directory(lcExistent), Seconds() - lnStart
>>
>>lnStart			= Seconds()
>>loFSO			= Createobject('Scripting.FileSystemObject')
>>try
>>	loFolder		= loFSO.getFolder(lcNotExistent)
>>catch
>>	loFolder		= null
>>endtry
>>
>>? lcNotExistent, not Isnull(loFolder), Seconds() - lnStart
>>
>>lnStart			= Seconds()
>>loFSO			= Createobject('Scripting.FileSystemObject')
>>try
>>	loFolder		= loFSO.getFolder(lcExistent)
>>catch
>>	loFolder		= null
>>endtry
>>
>>? lcExistent, not Isnull(loFolder), Seconds() - lnStart
>>
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform