From d969856ca447c33a887838754b5692501f058dfa Mon Sep 17 00:00:00 2001 From: sun Date: Wed, 27 Sep 2023 15:42:49 +0800 Subject: [PATCH] perf[protocol]: prediction Length --- .../com/zfoo/protocol/serializer/reflect/ArraySerializer.java | 2 +- .../com/zfoo/protocol/serializer/reflect/ListSerializer.java | 2 +- .../com/zfoo/protocol/serializer/reflect/MapSerializer.java | 2 +- .../com/zfoo/protocol/serializer/reflect/SetSerializer.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/ArraySerializer.java b/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/ArraySerializer.java index bf12bf7ce..831f6f320 100644 --- a/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/ArraySerializer.java +++ b/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/ArraySerializer.java @@ -78,7 +78,7 @@ public Object defaultValue(IFieldRegistration fieldRegistration) { public int predictionLength(IFieldRegistration fieldRegistration) { ArrayField arrayField = (ArrayField) fieldRegistration; var length = arrayField.getArrayElementRegistration().serializer().predictionLength(arrayField.getArrayElementRegistration()); - return 9 * length; + return 7 * length; } } diff --git a/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/ListSerializer.java b/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/ListSerializer.java index a205b685c..fb1c3549b 100644 --- a/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/ListSerializer.java +++ b/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/ListSerializer.java @@ -73,6 +73,6 @@ public Object defaultValue(IFieldRegistration fieldRegistration) { public int predictionLength(IFieldRegistration fieldRegistration) { ListField listField = (ListField) fieldRegistration; var length = listField.getListElementRegistration().serializer().predictionLength(listField.getListElementRegistration()); - return 9 * length; + return 7 * length; } } diff --git a/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/MapSerializer.java b/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/MapSerializer.java index dfe9ea29e..54a698ae1 100644 --- a/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/MapSerializer.java +++ b/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/MapSerializer.java @@ -81,6 +81,6 @@ public int predictionLength(IFieldRegistration fieldRegistration) { var mapField = (MapField) fieldRegistration; var keyLength = mapField.getMapKeyRegistration().serializer().predictionLength(mapField.getMapKeyRegistration()); var valueLength = mapField.getMapValueRegistration().serializer().predictionLength(mapField.getMapValueRegistration()); - return 9 * (keyLength + valueLength); + return 7 * (keyLength + valueLength); } } diff --git a/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/SetSerializer.java b/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/SetSerializer.java index 457aea16d..7e1fe4c03 100644 --- a/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/SetSerializer.java +++ b/protocol/src/main/java/com/zfoo/protocol/serializer/reflect/SetSerializer.java @@ -75,7 +75,7 @@ public Object defaultValue(IFieldRegistration fieldRegistration) { public int predictionLength(IFieldRegistration fieldRegistration) { var setField = (SetField) fieldRegistration; var length = setField.getSetElementRegistration().serializer().predictionLength(setField.getSetElementRegistration()); - return 9 * length; + return 7 * length; } }