ptupitsyn commented on a change in pull request #434:
URL: https://github.com/apache/ignite-3/pull/434#discussion_r746771644



##########
File path: 
modules/client-handler/src/integrationTest/java/org/apache/ignite/client/handler/ItClientHandlerTest.java
##########
@@ -167,7 +167,7 @@ void testHandshakeInvalidVersionReturnsError() throws 
Exception {
             final var err = unpacker.unpackString();
             
             assertArrayEquals(MAGIC, magic);
-            assertEquals(31, len);
+            assertEquals(32, len);

Review comment:
       Please see comments in `ClientMessagePacker#packString`. Basically we 
reserve string header size pessimistically to avoid extra string scan. It is 
better to write 1 extra byte than to spend time on precise utf8 byte length 
calculation.
   
   The code from the library that we've used before was doing `byte[] bytes = 
str.getBytes()` and then copied those bytes to the target buffer, which 
involves an extra allocation and an extra copy.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to