Skip to content

Commit

Permalink
Issue #5287 - make default CompressionPool capacity 1024
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
  • Loading branch information
lachlan-roberts committed Oct 14, 2020
1 parent ef816fc commit 608a895
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -923,12 +923,12 @@ public void setInflaterPoolCapacity(int capacity)

protected InflaterPool newInflaterPool()
{
return new InflaterPool(CompressionPool.INFINITE_CAPACITY, true);
return new InflaterPool(CompressionPool.DEFAULT_CAPACITY, true);
}

protected DeflaterPool newDeflaterPool()
{
return new DeflaterPool(CompressionPool.INFINITE_CAPACITY, Deflater.DEFAULT_COMPRESSION, true);
return new DeflaterPool(CompressionPool.DEFAULT_CAPACITY, Deflater.DEFAULT_COMPRESSION, true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

public abstract class CompressionPool<T> extends AbstractLifeCycle
{
public static final int INFINITE_CAPACITY = Integer.MAX_VALUE;
public static final int DEFAULT_CAPACITY = 1024;

private int _capacity;
private Pool<Entry> _pool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public class WebSocketComponents
public WebSocketComponents()
{
this(new WebSocketExtensionRegistry(), new DecoratedObjectFactory(), new MappedByteBufferPool(),
new InflaterPool(CompressionPool.INFINITE_CAPACITY, true),
new DeflaterPool(CompressionPool.INFINITE_CAPACITY, Deflater.DEFAULT_COMPRESSION, true));
new InflaterPool(CompressionPool.DEFAULT_CAPACITY, true),
new DeflaterPool(CompressionPool.DEFAULT_CAPACITY, Deflater.DEFAULT_COMPRESSION, true));
}

public WebSocketComponents(WebSocketExtensionRegistry extensionRegistry, DecoratedObjectFactory objectFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class DeflaterPoolBenchmark
public static final String COMPRESSION_STRING = "hello world";
DeflaterPool _pool;

@Param({"NO_POOL", "DEFLATER_POOL_10", "DEFLATER_POOL_20", "DEFLATER_POOL_50"})
@Param({"NO_POOL", "DEFLATER_POOL_10", "DEFLATER_POOL_20", "DEFLATER_POOL_50", "DEFLATER_POOL_DEFAULT"})
public static String poolType;

@Setup(Level.Trial)
Expand All @@ -75,6 +75,10 @@ public void setupTrial() throws Exception
capacity = 50;
break;

case "DEFLATER_POOL_DEFAULT":
capacity = DeflaterPool.DEFAULT_CAPACITY;
break;

default:
throw new IllegalStateException("Unknown poolType Parameter");
}
Expand Down

0 comments on commit 608a895

Please sign in to comment.