<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:42:24 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-2383] Provide overloads for WriteBytes/ReadBytes methods that allow buffer reuse</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2383</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I&apos;d like to &lt;em&gt;reuse&lt;/em&gt; one allocated buffer to read and one buffer to write to the mongodb. Currently one must use WriteBytes(byte[]) and byte[] ReadBytes() to read and write byte arrays. These arrays must be pre allocated with the correct size.&lt;/p&gt;

&lt;p&gt;If you want to reuse a buffer it would be nice to get some overloads with a size restriction like:&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;void&lt;/b&gt;&#160;IBsonWriter.&lt;b&gt;WriteBytes(byte[] bytes, int size);&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;This overload should only write &lt;em&gt;size&lt;/em&gt; bytes to the document.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;void&lt;/b&gt;&#160;IBsonWriter.&lt;b&gt;ReadBytes(byte[] buffer, int offset, int size);&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;This overload should only fill the count of bytes defined by &lt;em&gt;size&lt;/em&gt; starting at offset.&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;This would reduce memory fragmentation in the program.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="603108">CSHARP-2383</key>
            <summary>Provide overloads for WriteBytes/ReadBytes methods that allow buffer reuse</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="bpiorczig">Benjamin Piorczig</reporter>
                        <labels>
                    </labels>
                <created>Wed, 12 Sep 2018 12:58:01 +0000</created>
                <updated>Thu, 31 Mar 2022 00:27:06 +0000</updated>
                                            <version>2.7.0</version>
                                                    <component>BSON</component>
                                        <votes>1</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="2044222" author="bpiorczig" created="Sat, 27 Oct 2018 20:48:39 +0000"  >&lt;p&gt;@&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ugurpelister&quot; class=&quot;user-hover&quot; rel=&quot;ugurpelister&quot;&gt;ugurpelister&lt;/a&gt;: Thank you for pointing this out. This may be a solution in future but for now i need one that runs on .NET 4.6.x.&lt;/p&gt;

&lt;p&gt;@&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jeff.yemin&quot; class=&quot;user-hover&quot; rel=&quot;jeff.yemin&quot;&gt;jeff.yemin&lt;/a&gt;: You are right. I am currently using this in a custom serializer. I&apos;d like to store a large amount of float values in a document with a timestamp. If i store all the values normalized as float[] things seem to get too slow when reading the data. I do convert these values to a byte array and write it to the document as binary data. The byte arrays i use are managed from a .NET BufferManager derivate.&lt;/p&gt;

&lt;p&gt;@&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=vincent.kam&quot; class=&quot;user-hover&quot; rel=&quot;vincent.kam&quot;&gt;vincent.kam&lt;/a&gt;: Thanks for posting a link to my github pull request that implements this. Seem like i forgot to post that here.&lt;/p&gt;</comment>
                            <comment id="2038093" author="jeff.yemin" created="Mon, 22 Oct 2018 19:46:14 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=bpiorczig&quot; class=&quot;user-hover&quot; rel=&quot;bpiorczig&quot;&gt;bpiorczig&lt;/a&gt; this seems like a reasonable request, but we&apos;d like more information on the scenario in which you envision these new methods being used.  In particular, the driver itself would not be able to make use of these methods when reading from or writing to MongoDB.  It would have to be via a custom-written Serializer.&lt;/p&gt;</comment>
                            <comment id="2038079" author="vincent.kam" created="Mon, 22 Oct 2018 19:40:25 +0000"  >&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/pull/342&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/pull/342&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2010205" author="JIRAUSER1253531" created="Fri, 21 Sep 2018 10:59:11 +0000"  >&lt;p&gt;Hi. I just created the issue &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2391&quot; title=&quot;Provide an overload for JsonWriter.WriteValue to accept Span&amp;lt;byte&amp;gt; input&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2391&quot;&gt;CSHARP-2391&lt;/a&gt;. If the new &lt;tt&gt;Span&amp;lt;T&amp;gt;&lt;/tt&gt; gets implemented in the driver, then pre-allocated buffers can be reused while portions of these buffers can be read/written using &lt;tt&gt;Span&amp;lt;byte&amp;gt;&lt;/tt&gt; in your case.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hty80v:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>