[
https://issues.apache.org/jira/browse/IGNITE-29094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nikolay Izhikov updated IGNITE-29094:
-------------------------------------
Description:
Currently, useless byte array creation happens during each request.
{noformat}
/**
* @param req Request.
* @throws IOException In case of IO error.
*/
private void sendRequestRaw(JdbcRequest req) throws IOException {
int cap = guessCapacity(req);
BinaryWriterEx writer = BinaryUtils.writer(ctx,
BinaryStreams.outputStream(cap));
req.writeBinary(writer, protoCtx);
synchronized (connMux) {
send(writer.out().arrayCopy());
}
}
{noformat}
We can easily simlify this
was:
Currently, useless byte array creation happens during each marshalling.
{noformat}
ClientUtils {
....
/** Write Ignite binary object to output stream. */
void writeObject(BinaryOutputStream out, Object obj)
{
out.writeByteArray(marsh.marshal(obj));
}
}
{noformat}
This call routes to
{noformat}
GridBinaryMarshaller {
public byte[] marshal(@Nullable Object obj, boolean failIfUnregistered)
throws BinaryObjectException
{
if (obj == null)
return new byte[] \\{ NULL };
try (BinaryWriterEx writer = BinaryUtils.binariesFactory.writer(ctx,
failIfUnregistered))
{
writer.marshal(obj);
return writer.out().arrayCopy();
}
}
{noformat}
which create arrayCopy and writes it to BinaryOutputStream right away.
We can simplify this and improve memory allocation here.
> Get rid of useless byte array creation during thin jdbc request
> ---------------------------------------------------------------
>
> Key: IGNITE-29094
> URL: https://issues.apache.org/jira/browse/IGNITE-29094
> Project: Ignite
> Issue Type: Improvement
> Reporter: Nikolay Izhikov
> Assignee: Nikolay Izhikov
> Priority: Major
> Labels: ise
> Fix For: 2.19
>
>
> Currently, useless byte array creation happens during each request.
>
> {noformat}
> /**
> * @param req Request.
> * @throws IOException In case of IO error.
> */
> private void sendRequestRaw(JdbcRequest req) throws IOException {
> int cap = guessCapacity(req);
> BinaryWriterEx writer = BinaryUtils.writer(ctx,
> BinaryStreams.outputStream(cap));
> req.writeBinary(writer, protoCtx);
> synchronized (connMux) {
> send(writer.out().arrayCopy());
> }
> }
> {noformat}
> We can easily simlify this
--
This message was sent by Atlassian Jira
(v8.20.10#820010)