Raja Rajan

Raja Rajan

  • 1.8k
  • 18
  • 1.2k

memory write takes more time

Dec 13 2018 8:29 AM
Hi,
 
We recently migrated the server from windows 2008 r2 to windows 2012 r2. We are using ICSharpCode.SharpZipLib.Zip dll to compress the files.
 
ZipOutputStream.write (highlighted line) used to convert the bytes as file in the zip file. But it takes more time in the new server. I am unaware whether it a memory related issue or unable to find the cause of the issue.
 
We didn't faced this problem in the existing server. Please help.
 
Dim fs As FileStream
Dim buf As Byte()
Dim zs As New ZipOutputStream(File.Create(OutputZipFilePath))
If sPass IsNot Nothing AndAlso sPass <> [String].Empty Then
zs.Password = sPass
End If
zs.SetLevel(9)
Dim ze As ZipEntry
Dim sFile As String
For Each sFile In ar
ze = New ZipEntry(sFile.Remove(0, inputFolder.Length))
Dim fi As New FileInfo(sFile)
ze.DateTime = fi.LastWriteTime
zs.PutNextEntry(ze)
If Not sFile.EndsWith("/") Then
fs = File.OpenRead(sFile)
buf = New Byte(CType(fs.Length, Integer) - 1) {}
fs.Read(buf, 0, buf.Length)
zs.Write(buf, 0, buf.Length)
fs.Close()
End If
Next
zs.Finish()
zs.Close()
 
 
Thanks,
Rajarajan 

Answers (1)