public int BrotliServiceArrayPool() { var buffer = ArrayPool <byte> .Shared.Rent(Constants.MAX_USABLE_BYTES_IN_PAGE + 500); var res = _brotliCompressionService.Compress(_bytesOrg, buffer); var r = res.Length; ArrayPool <byte> .Shared.Return(buffer); return(r); }
public void Compression() { BrotliCompressionService brotliCompressionService = new BrotliCompressionService(); var bogus = new Bogus.Randomizer(); var bytesOrg = Encoding.UTF8.GetBytes(new Lorem().Sentence(500)); var span = new Span <byte>(new byte[bytesOrg.Length + 50]); var result = brotliCompressionService.Compress(bytesOrg, span); result.Length.ShouldBeLessThan(bytesOrg.Length); }