Use separate threads for decryption and decompression

This commit is contained in:
BruceChen 2022-08-30 17:37:46 +08:00
parent c941d086d9
commit 1a90b6d942
8 changed files with 47 additions and 37 deletions

View file

@ -141,8 +141,6 @@ namespace Ionic.Zlib
return oldCheck;
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
internal int Process(int r)
{
int t; // temporary storage
@ -676,7 +674,6 @@ namespace Ionic.Zlib
}
// copy as much as possible from the sliding window to the output area
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
internal int Flush(int r)
{
int nBytes;
@ -803,7 +800,7 @@ namespace Ionic.Zlib
tree = null;
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
internal int Process(InflateBlocks blocks, int r)
{
int j; // temporary storage
@ -1165,8 +1162,7 @@ namespace Ionic.Zlib
// (the maximum string length) and number of input bytes available
// at least ten. The ten bytes are six bytes for the longest length/
// distance pair plus four bytes for overloading the bit buffer.
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
internal int InflateFast(int bl, int bd, int[] tl, int tl_index, int[] td, int td_index, InflateBlocks s, ZlibCodec z)
{
int t; // temporary pointer
@ -1515,7 +1511,6 @@ namespace Ionic.Zlib
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
internal int Inflate(FlushType flush)
{
int b;

View file

@ -171,7 +171,6 @@ namespace Ionic.Zlib
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
private void finish()
{
if (_z == null) return;
@ -301,7 +300,6 @@ namespace Ionic.Zlib
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public override void Close()
{
if (_stream == null) return;
@ -416,7 +414,6 @@ namespace Ionic.Zlib
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public override System.Int32 Read(System.Byte[] buffer, System.Int32 offset, System.Int32 count)
{
// According to MS documentation, any implementation of the IO.Stream.Read function must:

View file

@ -352,7 +352,6 @@ namespace Ionic.Zlib
/// </example>
/// <param name="flush">The flush to use when inflating.</param>
/// <returns>Z_OK if everything goes well.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public int Inflate(FlushType flush)
{
if (istate == null)

View file

@ -410,7 +410,6 @@ namespace Ionic.Zlib
/// <param name="disposing">
/// indicates whether the Dispose method was invoked by user code.
/// </param>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
protected override void Dispose(bool disposing)
{
try
@ -545,10 +544,9 @@ namespace Ionic.Zlib
/// <param name="count">the number of bytes to read.</param>
///
/// <returns>the number of bytes read</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public override int Read(byte[] buffer, int offset, int count)
{
if (_disposed) throw new ObjectDisposedException("ZlibStream");
if (_disposed) throw new ObjectDisposedException("ZlibStream");
return _baseStream.Read(buffer, offset, count);
}