We are using a custom provider (copied from this site) to store the pathnames of files in a sql database. Right now we have about 4000 records which represents folders and files. The page is taking about 30-60 seconds to load, and it gets successively slower as people add more files.
If the File Explorer's Treeview loads on demand, as it seemingly does, why is ResolveRootDirectoryAsTree() so recursive? I believe its this function which is causing the slow load time.
If the File Explorer's Treeview loads on demand, as it seemingly does, why is ResolveRootDirectoryAsTree() so recursive? I believe its this function which is causing the slow load time.
6 Answers, 1 is accepted
0
Tim
Top achievements
Rank 1
answered on 23 Jul 2010, 06:47 PM
I'm having the same problem. I got the UNC pathing to work, but it takes 1-2 minutes for the page to load and then when I expand the root of one of the UNC folders, there's another delay of around a minute.
0
David
Top achievements
Rank 2
answered on 23 Jul 2010, 07:07 PM
Hi Tim,
We determined the problem to lay with the Custom Provider that is posted in the Forum and commonly referred to by Telerik and others.
Since the TreeView used in the File Explorer loads on demand by its nature, there is no need to make the subsequent calls to GetChildDirectories() be recursive.
Make this simple change and you will find a huge performance increase.
We determined the problem to lay with the Custom Provider that is posted in the Forum and commonly referred to by Telerik and others.
Since the TreeView used in the File Explorer loads on demand by its nature, there is no need to make the subsequent calls to GetChildDirectories() be recursive.
Make this simple change and you will find a huge performance increase.
Private Function GetChildDirectories(ByVal path As String) As DirectoryItem() Dim directories As List(Of DirectoryItem) = New List(Of DirectoryItem)() Try Dim dt As DataTable = fm.GetChildDirectories(path) Dim i As Integer = 0 For Each childRow As DataRow In dt.Rows Dim name As String = childRow("Title").ToString() Dim itemFullPath As String = EndWithSlash(CombinePath(path, name)) 'directories.Add(New DirectoryItem(name, String.Empty, itemFullPath, itemFullPath, fullPermissions, GetChildFiles(itemFullPath), GetChildDirectories(itemFullPath))) directories.Add(New DirectoryItem(name, String.Empty, itemFullPath, itemFullPath, fullPermissions, Nothing, Nothing)) Next Return directories.ToArray() Catch ex As Exception Return New DirectoryItem() {} End Try End Function0
Tim
Top achievements
Rank 1
answered on 23 Jul 2010, 07:23 PM
Thanks David. I'm using the "PhysicalpathFilesystemProvider_vb" sample downloaded from here and there isn't a GetChildDirectories function within the customFileSystemProvide.vb file, but I'll poke around some more as I know it's a recursive issue like you. The last test I ran, the web page took 55 seconds to load, and then when I tried "opening" one of the UNC folders, it took 90 seconds for any data to be populated. The directory info gets loaded quickly, but I think it is when it then has to parse through the MANY subfolders within the folders in the root of the UNC path I'm trying to expose,
-Tim
-Tim
0
David
Top achievements
Rank 2
answered on 23 Jul 2010, 07:34 PM
Yeah. that is exactly the issue. If subsequent calls are all load on demand, there is no need for any of the functions to be recursive.
0
Tim
Top achievements
Rank 1
answered on 23 Jul 2010, 07:43 PM
Which source file has the GetChildDirectories call?
0
Tim
Top achievements
Rank 1
answered on 23 Jul 2010, 08:28 PM
Night and Day difference here. Thanks to David for pointing me in the right direction.
I'm using the CustomFileSystemProvider in order to parse UNC paths and recursion was causing LONG delays. Since each subfolder can be loaded on demand, there's no use for loading the entire tree at startup. All I changed was one line:
I'm using the CustomFileSystemProvider in order to parse UNC paths and recursion was causing LONG delays. Since each subfolder can be loaded on demand, there's no use for loading the entire tree at startup. All I changed was one line:
Private Function GetDirectories(ByVal virtualPath As String) As DirectoryItem() Dim directoryItems As New List(Of DirectoryItem)() Dim physicalPath As String = Me.GetPhysicalFromVirtualPath(virtualPath) If physicalPath Is Nothing Then Return Nothing End If Dim directories As String() Try directories = Directory.GetDirectories(physicalPath) Array.Sort(directories) ' Can throw an exeption ; For Each dirPath As String In directories Dim dirInfo As New DirectoryInfo(dirPath) Dim newVirtualPath As String = PathHelper.AddEndingSlash(virtualPath, "/") + PathHelper.GetDirectoryName(dirPath) & "/" 'Dim dirItem As New DirectoryItem(PathHelper.GetDirectoryName(dirPath), String.Empty, newVirtualPath, PathHelper.AddEndingSlash(virtualPath, "/"), GetPermissions(dirPath), GetFiles(virtualPath), Nothing) Dim dirItem As New DirectoryItem(PathHelper.GetDirectoryName(dirPath), String.Empty, newVirtualPath, PathHelper.AddEndingSlash(virtualPath, "/"), GetPermissions(dirPath), Nothing, Nothing) directoryItems.Add(dirItem) Next Catch generatedExceptionName As IOException ' The parent directory is moved or deleted End Try Return directoryItems.ToArray() End Function