From 3845790c5d24ea69b1724acd45fdf27a76321c0c Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 20 May 2020 10:47:23 +0200 Subject: [PATCH] Hpack optimizations If the dynamic table size is already 0, do not evictAll. Signed-off-by: Greg Wilkins --- .../eclipse/jetty/http2/hpack/HpackContext.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java index ab587240876..5625b2c0cb9 100644 --- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java +++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java @@ -395,12 +395,15 @@ public class HpackContext { if (LOG.isDebugEnabled()) LOG.debug(String.format("HdrTbl[%x] evictAll", HpackContext.this.hashCode())); - _fieldMap.clear(); - _nameMap.clear(); - _offset = 0; - _size = 0; - _dynamicTableSizeInBytes = 0; - Arrays.fill(_entries, null); + if (size() > 0) + { + _fieldMap.clear(); + _nameMap.clear(); + _offset = 0; + _size = 0; + _dynamicTableSizeInBytes = 0; + Arrays.fill(_entries, null); + } } }