You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/11/10 16:33:00 UTC

[GitHub] [ignite-3] ptupitsyn commented on a change in pull request #434: IGNITE-15234 Implement ByteBuf-based message packer and unpacker

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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org