<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:41:14 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-1972] Performance of method ToHexString()</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1972</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;From several profiling sessions of my application I&apos;ve noticed that method ToHexString() is used very often. DotTrace has also marked it as one of hot methods during profiling. I&apos;ve found a solution which has about 40x speedup in compare with current implementation.&lt;br/&gt;
Here&apos;s attached benchmarking info and code:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;BenchmarkDotNet=v0.10.5, OS=Windows 10.0.15063&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Processor=Intel Core i5-2400 CPU 3.10GHz (Sandy Bridge), ProcessorCount=4&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Frequency=3037251 Hz, Resolution=329.2451 ns, Timer=TSC&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;  [Host]     : Clr 4.0.30319.42000, 32bit LegacyJIT-v4.7.2046.0&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;  DefaultJob : Clr 4.0.30319.42000, 32bit LegacyJIT-v4.7.2046.0&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;                Method |      Mean |     Error |    StdDev |&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;---------------------- |----------:|----------:|----------:|&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; MongoDbImplementation | 97.146 us | 1.1451 us | 1.0711 us |&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;             HandCoded |  1.932 us | 0.0216 us | 0.0202 us |&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Benchmark code: &lt;a href=&quot;https://gist.github.com/ahydrax/477fedfe5a44bb49ff862b554694a4f1&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://gist.github.com/ahydrax/477fedfe5a44bb49ff862b554694a4f1&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="378928">CSHARP-1972</key>
            <summary>Performance of method ToHexString()</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="damien.guard@mongodb.com">Damien Guard</assignee>
                                    <reporter username="ahydrax">Viktor Svyatokha</reporter>
                        <labels>
                            <label>devexp-product</label>
                            <label>performance</label>
                    </labels>
                <created>Sat, 29 Apr 2017 13:05:19 +0000</created>
                <updated>Tue, 6 Feb 2024 11:34:00 +0000</updated>
                                            <version>2.4.3</version>
                                    <fixVersion>2.4.4</fixVersion>
                                    <component>Performance</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="6070809" author="JIRAUSER1273673" created="Tue, 6 Feb 2024 11:32:27 +0000"  >&lt;p&gt;Hi Viktor. We&apos;re going through some older PRs that were overlooked for various reasons and taking another look. I re-ran the benchmarks on .NET 7 and also included using the new `Convert.ToHex` function available in .NET 5.0 and later.&lt;br/&gt;
&#160;&lt;br/&gt;
&lt;tt&gt;| Method &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;| Mean &#160; &#160; &#160; &#160;| Error &#160; &#160; &#160; | StdDev &#160; &#160;|&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;|---------------------- |-----------&lt;del&gt;:|&lt;/del&gt;----------&lt;del&gt;:|&lt;/del&gt;---------:|&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;| MongoDbImplementation | 12,485.3 ns | 2,114.60 ns | 115.91 ns |&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;| HandCoded &#160; &#160; &#160; &#160; &#160; &#160; | &#160; &#160;718.0 ns | &#160; 266.98 ns | &#160;14.63 ns |&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;| DotNetBuiltIn &#160; &#160; &#160; &#160; | &#160; &#160;130.3 ns | &#160; &#160;73.88 ns | &#160; 4.05 ns |&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;The new Convert.ToHex uses SIMD instructions where appropriate and has very highly optimized code offering further performance gains. I&apos;m going to recommend we switch to that as part of the C# Driver 3.0 work when we drop support for older targets.&lt;/p&gt;</comment>
                            <comment id="2157878" author="JIRAUSER1256534" created="Wed, 20 Feb 2019 23:56:07 +0000"  >&lt;p&gt;Additional PR &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/pull/285&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/pull/285&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1564409" author="xgen-internal-githook" created="Thu, 4 May 2017 13:54:37 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;rstam&apos;, u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@robertstam.org&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1972&quot; title=&quot;Performance of method ToHexString()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1972&quot;&gt;CSHARP-1972&lt;/a&gt;: Optimize BsonUtils.ToHexString and ObjectId.ToString.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/2894c3df1cf155a793aa8641cbc6cdb6cf308a7a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/2894c3df1cf155a793aa8641cbc6cdb6cf308a7a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1560889" author="ahydrax" created="Sat, 29 Apr 2017 13:53:40 +0000"  >&lt;p&gt;&lt;a href=&quot;http://joxi.ru/gmvgWe9HLwRzV2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://joxi.ru/gmvgWe9HLwRzV2&lt;/a&gt; detailed profiling info for this method&lt;br/&gt;
&lt;a href=&quot;http://joxi.ru/DmBDPE0fwvYQ3A&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://joxi.ru/DmBDPE0fwvYQ3A&lt;/a&gt; stack trace&lt;/p&gt;

&lt;p&gt;I can&apos;t provide full stack trace because of NDA but I&apos;ll try to provide as much info as possible &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="1560882" author="craiggwilson" created="Sat, 29 Apr 2017 13:07:56 +0000"  >&lt;p&gt;Interesting. Thanks for sending. I&apos;m not surprised that ours is slow. We didn&apos;t spend time optimizing it. I am surprised that it&apos;s showing up in the hot path, which is why we didn&apos;t spend any time optimizing it.&lt;/p&gt;

&lt;p&gt;Do you know that stacktrace that was ultimately causing it to get hit so often?&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|hrau5r:</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>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1681">C# Sprint 52</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>