| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,7 +50,7 @@ public static class Config | |||
| 50 | 50 | private final int stringEncoderBufferSize; | |
| 51 | 51 | private final int stringDecoderBufferSize; | |
| 52 | 52 | private final int packerBufferSize; | |
| 53 | - private final int packerLargeStringThreshold; | ||
| 53 | + private final int packerSmallStringOptimizationThreshold; // This parameter is subject to change | ||
| 54 | 54 | private final int packerRawDataCopyingThreshold; | |
| 55 | 55 | ||
| 56 | 56 | public Config( | |
@@ -62,7 +62,7 @@ public Config( | |||
| 62 | 62 | int stringEncoderBufferSize, | |
| 63 | 63 | int stringDecoderBufferSize, | |
| 64 | 64 | int packerBufferSize, | |
| 65 | - int packerLargeStringLengthThreshold, | ||
| 65 | + int packerSmallStringOptimizationThreshold, | ||
| 66 | 66 | int packerRawDataCopyingThreshold) | |
| 67 | 67 | { | |
| 68 | 68 | checkArgument(packerBufferSize > 0, "packer buffer size must be larger than 0: " + packerBufferSize); | |
@@ -77,7 +77,7 @@ public Config( | |||
| 77 | 77 | this.stringEncoderBufferSize = stringEncoderBufferSize; | |
| 78 | 78 | this.stringDecoderBufferSize = stringDecoderBufferSize; | |
| 79 | 79 | this.packerBufferSize = packerBufferSize; | |
| 80 | - this.packerLargeStringThreshold = packerLargeStringLengthThreshold; | ||
| 80 | + this.packerSmallStringOptimizationThreshold = packerSmallStringOptimizationThreshold; | ||
| 81 | 81 | this.packerRawDataCopyingThreshold = packerRawDataCopyingThreshold; | |
| 82 | 82 | } | |
| 83 | 83 | ||
@@ -136,9 +136,9 @@ public int getPackerBufferSize() | |||
| 136 | 136 | return packerBufferSize; | |
| 137 | 137 | } | |
| 138 | 138 | ||
| 139 | - public int getPackerLargeStringLengthThreshold() | ||
| 139 | + public int getPackerSmallStringOptimizationThreshold() | ||
| 140 | 140 | { | |
| 141 | - return packerLargeStringThreshold; | ||
| 141 | + return packerSmallStringOptimizationThreshold; | ||
| 142 | 142 | } | |
| 143 | 143 | ||
| 144 | 144 | public int getPackerRawDataCopyingThreshold() | |
@@ -162,7 +162,7 @@ public static class ConfigBuilder | |||
| 162 | 162 | private int stringEncoderBufferSize = 8192; | |
| 163 | 163 | private int stringDecoderBufferSize = 8192; | |
| 164 | 164 | private int packerBufferSize = 8192; | |
| 165 | - private int packerLargeStringLengthThreshold = 512; | ||
| 165 | + private int packerSmallStringOptimizationThreshold = 512; // This parameter is subject to change | ||
| 166 | 166 | private int packerRawDataCopyingThreshold = 512; | |
| 167 | 167 | ||
| 168 | 168 | public Config build() | |
@@ -176,7 +176,7 @@ public Config build() | |||
| 176 | 176 | stringEncoderBufferSize, | |
| 177 | 177 | stringDecoderBufferSize, | |
| 178 | 178 | packerBufferSize, | |
| 179 | - packerLargeStringLengthThreshold, | ||
| 179 | + packerSmallStringOptimizationThreshold, | ||
| 180 | 180 | packerRawDataCopyingThreshold | |
| 181 | 181 | ); | |
| 182 | 182 | } | |
@@ -229,9 +229,9 @@ public ConfigBuilder packerBufferSize(int size) | |||
| 229 | 229 | return this; | |
| 230 | 230 | } | |
| 231 | 231 | ||
| 232 | - public ConfigBuilder packerLargeStringThreshold(int threshold) | ||
| 232 | + public ConfigBuilder packerSmallStringOptimizationThreshold(int threshold) | ||
| 233 | 233 | { | |
| 234 | - this.packerLargeStringLengthThreshold = threshold; | ||
| 234 | + this.packerSmallStringOptimizationThreshold = threshold; | ||
| 235 | 235 | return this; | |
| 236 | 236 | } | |
| 237 | 237 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -445,7 +445,7 @@ public MessagePacker packDouble(double v) | |||
| 445 | 445 | private void packSmallString(String s) | |
| 446 | 446 | throws IOException | |
| 447 | 447 | { | |
| 448 | - byte[] bytes = s.getBytes("UTF-8"); | ||
| 448 | + byte[] bytes = s.getBytes(MessagePack.UTF8); | ||
| 449 | 449 | packRawStringHeader(bytes.length); | |
| 450 | 450 | writePayload(bytes); | |
| 451 | 451 | } | |
@@ -465,7 +465,7 @@ public MessagePacker packString(String s) | |||
| 465 | 465 | return this; | |
| 466 | 466 | } | |
| 467 | 467 | ||
| 468 | - if (s.length() < config.getPackerLargeStringLengthThreshold()) { | ||
| 468 | + if (s.length() < config.getPackerSmallStringOptimizationThreshold()) { | ||
| 469 | 469 | // Write the length and payload of small string to the buffer so that it avoids an extra flush of buffer | |
| 470 | 470 | packSmallString(s); | |
| 471 | 471 | return this; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments