Re: Large directories... DirectoryInfo or Win32 API?
From: Robert Jordan (robertj_at_gmx.net)
Date: 10/01/04
- Next message: Justin Rogers: "Re: Large directories... DirectoryInfo or Win32 API?"
- Previous message: Mike G.: "Re: Large directories... DirectoryInfo or Win32 API?"
- Maybe in reply to: Justin Rogers: "Re: Large directories... DirectoryInfo or Win32 API?"
- Next in thread: Justin Rogers: "Re: Large directories... DirectoryInfo or Win32 API?"
- Reply: Justin Rogers: "Re: Large directories... DirectoryInfo or Win32 API?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 01 Oct 2004 14:04:23 +0200
Justin Rogers wrote:
> Internally they are doing the Win32 API calls for you. However, they are
> also allocating a LOT of array space to do it. Specifically they are making
> an extra copy, which probably isn't necessary, and there is a possible
> resource leak in that particular method that they aren't accounting for.
Really weird is the fact that Directory.GetFiles returns a string array
with fully qualified file names. Imagine you want to enumerate
c:\documents and settings\
\SomeUsername
\Program Data
\some scary long company name
\even longer fancy product name
or some huge UNC path hierarchies
\\server\share\public\org\unit\projekt\subproject\trash\
DirectoryInfo.GetFiles returns an array of FileInfo which
is probably even larger then the fully qualified file name.
I wonder why MS didn't desiged that API to return an object
"FileList", whose enumerator calls Win32's FindNextFile
just in time (or on demand).
bye
Rob
- Next message: Justin Rogers: "Re: Large directories... DirectoryInfo or Win32 API?"
- Previous message: Mike G.: "Re: Large directories... DirectoryInfo or Win32 API?"
- Maybe in reply to: Justin Rogers: "Re: Large directories... DirectoryInfo or Win32 API?"
- Next in thread: Justin Rogers: "Re: Large directories... DirectoryInfo or Win32 API?"
- Reply: Justin Rogers: "Re: Large directories... DirectoryInfo or Win32 API?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|