akalash commented on a change in pull request #8577:
URL: https://github.com/apache/ignite/pull/8577#discussion_r546651327
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
##########
@@ -584,7 +587,21 @@ public DirectByteBufferStreamImplV2(MessageFactory
msgFactory) {
/** {@inheritDoc} */
@Override public void writeString(String val) {
- writeByteArray(val != null ? val.getBytes() : null);
+ if (val != null) {
+ if (buf.capacity() < val.length()) {
Review comment:
I don't think that this condition is right. for example if
'buf.capacity() > val.length()' and 'buf.remaining() < val.length()' that it
still requires to cache the bytes but in your case this won't happen. So maybe
it is better to remove that condition at all, I don't think that writing to the
local variable is too expensive so you can do it every time even it isn't
required for certain case. Or you should change you condition to the proper one.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]