<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:31:33 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>[SERVER-13382] shared_ptr uses a lot of CPU time during external sort (foreground index build)</title>
                <link>https://jira.mongodb.org/browse/SERVER-13382</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The database is larger than RAM and I am creating an index in the foreground. The shared_ptr destructor was frequently active when I used call stack sampling. The shared_count destructor used by shared_ptr was the #3 CPU consumer per Linux perf.&lt;/p&gt;

&lt;p&gt;I don&apos;t have much experience with modern C++. My experience with shared_ptr is mostly limited to finding that it uses too much CPU. Is the destructor getting called frequently because the copy constructor was invoked frequently?&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;    13.46%   mongod  mongod               [.] mongo::BSONObjIterator::next()                                                                                                                                                  &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;    11.56%   mongod  mongod               [.] mongo::BSONElement::size() const                                                                                                                                                            &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;     9.65%   mongod  mongod               [.] boost::detail::shared_count::~shared_count()                                                                                                                                              &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;     9.10%   mongod  mongod               [.] mongo::compareElementValues(mongo::BSONElement const&amp;amp;, mongo::BSONElement const&amp;amp;)                                                                                      &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;     6.40%   mongod  mongod               [.] mongo::BSONObj::woCompare(mongo::BSONObj const&amp;amp;, mongo::Ordering const&amp;amp;, bool) const                                                                      &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;     5.50%   mongod  libc-2.13.so         [.] __strlen_sse42    &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;An example is:&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;   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;boost::detail::shared_count::~shared_count,~shared_ptr,~ComparatorWithInterruptCheck,~STLComparator,std::pop_heap&amp;lt;__gnu_cxx::__normal_iterator&amp;lt;boost::shared_ptr&amp;lt;mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj,,mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj,,mongo::BtreeBulk::commit&amp;lt;mongo::BtreeData_V1&amp;gt;,mongo::BtreeBasedAccessMethod::commitBulk,mongo::buildAnIndex,mongo::IndexCatalog::createIndex,mongo::CmdCreateIndex::run,mongo::_execCommand,mongo::Command::execCommand,mongo::_runCommands,runCommands,mongo::newRunQuery,receivedQuery,mongo::assembleResponse,mongo::MyMessageHandler::process,mongo::PortMessageServer::handleIncomingMsg,start_thread,clone&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;And an example full stack trace is:&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;#0  boost::detail::shared_count::~shared_count (this=0x7f634a32e150, __in_chrg=&amp;lt;optimized out&amp;gt;) at src/third_party/boost/boost/smart_ptr/detail/shared_count.hpp:305&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;#1  0x00000000009d5c49 in ~shared_ptr (this=0x7f634a32e148, __in_chrg=&amp;lt;optimized out&amp;gt;) at src/third_party/boost/boost/smart_ptr/shared_ptr.hpp:164&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;#2  ~ComparatorWithInterruptCheck (this=0x7f634a32e140, __in_chrg=&amp;lt;optimized out&amp;gt;) at src/mongo/db/extsort.cpp:41&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;#3  ~STLComparator (this=0x7f634a32e140, __in_chrg=&amp;lt;optimized out&amp;gt;) at src/mongo/db/sorter/sorter.cpp:359&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;#4  std::pop_heap&amp;lt;__gnu_cxx::__normal_iterator&amp;lt;boost::shared_ptr&amp;lt;mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::Stream&amp;gt;*, std::vector&amp;lt;boost::shared_ptr&amp;lt;mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::Stream&amp;gt;, std::allocator&amp;lt;boost::shared_ptr&amp;lt;mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::Stream&amp;gt; &amp;gt; &amp;gt; &amp;gt;, mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::STLComparator&amp;gt;(__gnu_cxx::__normal_iterator&amp;lt;boost::shared_ptr&amp;lt;mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::Stream&amp;gt;*, std::vector&amp;lt;boost::shared_ptr&amp;lt;mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::Stream&amp;gt;, std::allocator&amp;lt;boost::shared_ptr&amp;lt;mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::Stream&amp;gt; &amp;gt; &amp;gt; &amp;gt;, __gnu_cxx::__normal_iterator&amp;lt;boost::shared_ptr&amp;lt;mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::Stream&amp;gt;*, std::vector&amp;lt;boost::shared_ptr&amp;lt;mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::Stream&amp;gt;, std::allocator&amp;lt;boost::shared_ptr&amp;lt;mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::Stream&amp;gt; &amp;gt; &amp;gt; &amp;gt;, mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::STLComparator) (__first=..., __last=..., __comp=...) at /mnt/gvfs/third-party/d28c90311ca14f9f0b2bb720f4e34b285513d4f4/gcc-4.6.2-glibc-2.13/libgcc/libgcc-4.6.2/b4e37bb/include/c++/4.6.2/bits/stl_heap.h:362#5  0x00000000009d6ade in mongo::sorter::MergeIterator&amp;lt;mongo::BSONObj, mongo::DiskLoc, mongo::{anonymous}::ComparatorWithInterruptCheck&amp;gt;::next(void) (this=0x36d8b00) at src/mongo/db/sorter/sorter.cpp:325#6  0x0000000000a334c3 in mongo::BtreeBulk::commit&amp;lt;mongo::BtreeData_V1&amp;gt; (this=0x1b23540, dupsToDrop=0x7f634a32e660, op=0x36ed000, mayInterrupt=true) at src/mongo/db/index/btree_based_access_method.cpp:406#7  0x0000000000a31cef in mongo::BtreeBasedAccessMethod::commitBulk (this=0x370e4e0, bulkRaw=0x1b23540, mayInterrupt=true, dupsToDrop=0x7f634a32e660) at src/mongo/db/index/btree_based_access_method.cpp:555#8  0x00000000008a31f4 in mongo::buildAnIndex (collection=0x3704680, btreeState=0x36f1700, mayInterrupt=true) at src/mongo/db/catalog/index_create.cpp:266#9  0x000000000089efef in mongo::IndexCatalog::createIndex (this=0x3704700, spec=..., mayInterrupt=true, shutdownBehavior=mongo::IndexCatalog::SHUTDOWN_CLEANUP) at src/mongo/db/catalog/index_catalog.cpp:334#10 0x00000000008cfa0f in mongo::CmdCreateIndex::run (this=&amp;lt;optimized out&amp;gt;, dbname=..., cmdObj=..., options=&amp;lt;optimized out&amp;gt;, errmsg=..., result=..., fromRepl=false) at src/mongo/db/commands/create_indexes.cpp:176#11 0x000000000095d7bf in mongo::_execCommand (c=&amp;lt;optimized out&amp;gt;, dbname=..., cmdObj=..., queryOptions=&amp;lt;optimized out&amp;gt;, errmsg=..., result=..., fromRepl=false) at src/mongo/db/dbcommands.cpp:1357#12 0x000000000095e2af in mongo::Command::execCommand (c=0x193fe60 &amp;lt;mongo::cmdCreateIndex&amp;gt;, client=..., queryOptions=0, cmdns=0x3189414 &quot;iibench.$cmd&quot;, cmdObj=..., result=..., fromRepl=false) at src/mongo/db/dbcommands.cpp:1544#13 0x000000000095eded in mongo::_runCommands (ns=0x3189414 &quot;iibench.$cmd&quot;, _cmdobj=..., b=..., anObjBuilder=..., fromRepl=false, queryOptions=0) at src/mongo/db/dbcommands.cpp:1648#14 0x0000000000b7e0cc in runCommands (queryOptions=&amp;lt;optimized out&amp;gt;, anObjBuilder=..., b=..., curop=..., jsobj=..., ns=0x3189414 &quot;iibench.$cmd&quot;, fromRepl=&amp;lt;optimized out&amp;gt;) at src/mongo/db/query/new_find.cpp:107#15 mongo::newRunQuery (m=..., q=..., curop=..., result=...) at src/mongo/db/query/new_find.cpp:384#16 0x0000000000a57860 in receivedQuery (m=..., dbresponse=..., c=...) at src/mongo/db/instance.cpp:269#17 mongo::assembleResponse (m=..., dbresponse=..., remote=...) at src/mongo/db/instance.cpp:433#18 0x00000000007a7d02 in mongo::MyMessageHandler::process (this=&amp;lt;optimized out&amp;gt;, m=..., port=0x1b22f50, le=0x1b23c70) at src/mongo/db/db.cpp:204#19 0x0000000000e40dd7 in mongo::PortMessageServer::handleIncomingMsg (arg=0x36c4d20) at src/mongo/util/net/message_server_port.cpp:209#20 0x00007f6349f03f81 in start_thread (arg=0x7f634a331700) at pthread_create.c:301#21 0x00007f634928185d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</description>
                <environment></environment>
        <key id="127956">SERVER-13382</key>
            <summary>shared_ptr uses a lot of CPU time during external sort (foreground index build)</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="louis.williams@mongodb.com">Louis Williams</assignee>
                                    <reporter username="mdcallag">Mark Callaghan</reporter>
                        <labels>
                    </labels>
                <created>Thu, 27 Mar 2014 17:19:56 +0000</created>
                <updated>Wed, 14 Aug 2019 16:15:31 +0000</updated>
                            <resolved>Wed, 14 Aug 2019 16:15:31 +0000</resolved>
                                    <version>2.6.0-rc2</version>
                                                    <component>Index Maintenance</component>
                    <component>Performance</component>
                                        <votes>2</votes>
                                    <watches>13</watches>
                                                                                                                <comments>
                            <comment id="2370964" author="louis.williams" created="Wed, 14 Aug 2019 16:15:31 +0000"  >&lt;p&gt;This issue has gone away. As seen in a local perf run:&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;+   19.75%  IndexBu.ongod-0  mongod              [.] mongo::BSONObj::woCompare                                                                                                                                                                                                                                               &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;+    7.08%  IndexBu.ongod-0  mongod              [.] mongo::BSONElement::BSONElement                                                                                                                                                                                                                                         &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;+    6.12%  IndexBu.ongod-0  mongod              [.] mongo::BSONElement::computeSize                                                                                                                                                                                                                                         &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;+    5.70%  IndexBu.ongod-0  mongod              [.] mongo::BSONElement::compareElements                                                                                                                                                                                                                                     &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;+    5.59%  IndexBu.ongod-0  libc-2.29.so        [.] __strlen_avx2                                                                                                                                                                                                                                                           &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;+    3.63%  IndexBu.ongod-0  mongod              [.] mongo::BSONElement::woCompare                                                                                                                                                                                                                                           &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;Here&apos;s at least one reason why:&lt;/p&gt;

&lt;p&gt;The external sorter today depends on copy-assignment of the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/af98422380e4f78fdf1edac3a6e5cb457bd5d0a6/src/mongo/db/sorter/sorter.h#L136&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Value type&lt;/a&gt; (i.e. BSONObj), which can be expensive if the copy assignment is expensive. BSONObj is backed by a ref-countable &lt;a href=&quot;https://github.com/mongodb/mongo/blob/af98422380e4f78fdf1edac3a6e5cb457bd5d0a6/src/mongo/util/shared_buffer.h#L179&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;SharedBuffer, which wraps boost::intrusive_ptr instead of shared_ptr&lt;/a&gt;. This is less expensive than copying an entire buffer, and also faster than shared_ptr. Because intrusive_ptr uses atomic instructions, a standard copy assignment will perform one atomic increment to make a copy of the buffer, then an atomic decrement when the original object is destructed.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://github.com/mongodb/mongo/blob/af98422380e4f78fdf1edac3a6e5cb457bd5d0a6/src/mongo/bson/bsonobj.h#L160&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;new assignment operator for BSONObj&lt;/a&gt; quite cleverly avoids these atomic instructions by using a swap operation when assigning from a non-const BSONObj.&lt;/p&gt;</comment>
                            <comment id="532864" author="schwerin" created="Wed, 2 Apr 2014 17:14:15 +0000"  >&lt;p&gt;This is happening because the &quot;next stream to merge&quot; is selected by popping out of a heap of shared pointers to streams.  This operation occurs with high frequency, and there&apos;s no need for the heap to store shared pointers to the streams.  The ownership could instead be maintained elsewhere.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 2 Apr 2014 17:14:15 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 26 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1345</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>louis.williams@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 26 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>louis.williams@mongodb.com</customfieldvalue>
            <customfieldvalue>mdcallag</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hriscv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hv8ie7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>109507</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="3092">Execution Team 2019-08-26</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hsh15z:</customfieldvalue>

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