GetDirectorySize invoked twice in InsertImage.aspx

Last post 07-04-2011, 1:29 AM by cutechat. 3 replies.
Sort Posts: Previous Next
  •  06-09-2011, 9:22 AM 67874

    GetDirectorySize invoked twice in InsertImage.aspx

    I was researching slow performence issue when InsertImage.aspx is displayed and I have discovered that GetDirectory size is invoked twice.
     
    This method is invoked when displaying the amount of space used:
    <td>&nbsp; [[Used]]: <%= CuteEditor.Impl.FileStorage.FormatSize(fs.GetDirectorySize(fs.VirtualRoot)) %></td>
     
    And it's invoked a second time to calculate the percentage of space used:
    protected int GetUsedPercent() {
       
    int w = Convert.ToInt32(100*fs.GetDirectorySize(fs.VirtualRoot)/(secset.MaxImageFolderSize * 1024));
       if(w<1)
          
    w=1;
       if(w>100)
          
    w=100;
       return w;
    }
    This is obviously ineficient and causes the file repository to be scanned twice. I know some users have complained that the image galery is slow to open when there's a large number of files in the repository, I think InsertImage.aspx can be improved to make sure this method is invoked only once and therfore improve performance.
  •  06-09-2011, 11:01 AM 67878 in reply to 67874

    Re: GetDirectorySize invoked twice in InsertImage.aspx

    Furthermore, I have discovered that GetDirectorySize is invoked twice after a file is uploaded and the upload triggers InsertImage.aspx to be refreshed which causes GetDirectorySize to be invoke twice more, for a total of four times!
  •  06-09-2011, 10:27 PM 67887 in reply to 67878

    Re: GetDirectorySize invoked twice in InsertImage.aspx

    Hi frJericho,
     
    We will improve the performance of the image dialog in next version.
     
    Many thanks for your tips.
     
    Regards,
     
    ken
     
     
  •  07-04-2011, 1:29 AM 68327 in reply to 67874

    Re: GetDirectorySize invoked twice in InsertImage.aspx

    Hi,
     
    Thanks for the advise.
    We have improved it and will provide an update in 24 hours.
    Regards,
    Terry
View as RSS news feed in XML