[ 
https://issues.apache.org/jira/browse/IGNITE-5904?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavel Tupitsyn updated IGNITE-5904:
-----------------------------------
    Description: 
Currently the only way to access array fields in {{IBinaryReader}} and 
{{IBinaryRawReader}} is copying them entirely into a new instance:
{code}
byte[] ReadByteArray();
{code}

This does not allow reusing existing array (array pooling) or reading only a 
part of the data (random access), which may hurt performance in certain use 
cases.

Many .NET APIs provide an approach where existing array is used with index and 
offset ({{Array.Copy}}, {{Socket.Receive}}, etc). 

We can do a similar thing for *arrays of fixed-size elements* (byte, int, etc):
{code}
int ReadByteArray(byte[] dest, int destOffset, int srcOffset, int count);
{code}

  was:
Currently the only way to work with array fields is reading them entirely into 
a new instance:
{code}
byte[] ReadByteArray();
{code}

This does not allow reusing existing array (array pooling) or reading only a 
part of the data (random access).

Many .NET APIs provide an approach where existing array is used with index and 
offset ({{Array.Copy}}, {{Socket.Receive}}, etc). 

We can do a similar thing for *arrays of fixed-size elements* (byte, int, etc):
{code}
int ReadByteArray(byte[] dest, int destOffset, int srcOffset, int count);
{code}


> .NET: Improve array access in IBinaryReader and IBinaryRawReader
> ----------------------------------------------------------------
>
>                 Key: IGNITE-5904
>                 URL: https://issues.apache.org/jira/browse/IGNITE-5904
>             Project: Ignite
>          Issue Type: Improvement
>          Components: platforms
>            Reporter: Pavel Tupitsyn
>              Labels: .NET
>
> Currently the only way to access array fields in {{IBinaryReader}} and 
> {{IBinaryRawReader}} is copying them entirely into a new instance:
> {code}
> byte[] ReadByteArray();
> {code}
> This does not allow reusing existing array (array pooling) or reading only a 
> part of the data (random access), which may hurt performance in certain use 
> cases.
> Many .NET APIs provide an approach where existing array is used with index 
> and offset ({{Array.Copy}}, {{Socket.Receive}}, etc). 
> We can do a similar thing for *arrays of fixed-size elements* (byte, int, 
> etc):
> {code}
> int ReadByteArray(byte[] dest, int destOffset, int srcOffset, int count);
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to