2012-05-02 12 views
0

この行のメモリに格納されているシステムの量(For Each objFile in objFolder.Files)と、objFile.Files.Countのようなものを使用して反復処理する方がより効果的かどうかはわかりません。次のコードを使用するとパフォーマンス上の問題が発生するかどうかは誰にも分かりますか?FileSystemObjectコレクションの繰り返しでのパフォーマンスチューニング

Dim objFSO 
Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 

'Get the folder object associated with the directory 
Dim objFolder 
Set objFolder = objFSO.GetFolder("C:\InetPub\wwwroot") 

Response.Write "The files found in " & objFolder.Name & ":<br>" 

'Loop through the Files collection 
Dim objFile 
For Each objFile in objFolder.Files 
    Response.Write objFile.Name & "<br>" 
Next 

'Clean up! 
Set objFolder = Nothing 
Set objFile = Nothing 
Set objFSO = Nothing 

答えて

0

私はどのくらいのシステムメモリに格納この行の各objfileのためにobjFolder.Files

ないあなたが何を意味するかわから知らないが、コレクションのこれは単なるループしますファイルオブジェクトは、多くのメモリを使用しません。あなたの質問であれば、この呼び出しはメモリ内のファイルの内容を明らかに読み込まないでしょう。

関連する問題