<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:52:54 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-20019] investigate SpiderMonkey performance degradation vs. v8</title>
                <link>https://jira.mongodb.org/browse/SERVER-20019</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description></description>
                <environment></environment>
        <key id="226179">SERVER-20019</key>
            <summary>investigate SpiderMonkey performance degradation vs. v8</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="greg.mckeon@mongodb.com">Gregory McKeon</assignee>
                                    <reporter username="adam.midvidy">Adam Midvidy</reporter>
                        <labels>
                    </labels>
                <created>Tue, 18 Aug 2015 21:16:27 +0000</created>
                <updated>Thu, 2 Aug 2018 21:26:07 +0000</updated>
                            <resolved>Mon, 24 Aug 2015 15:07:09 +0000</resolved>
                                                    <fixVersion>3.1.8</fixVersion>
                                    <component>JavaScript</component>
                    <component>Performance</component>
                    <component>Shell</component>
                                        <votes>0</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="1012956" author="xgen-internal-githook" created="Mon, 24 Aug 2015 15:06:39 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;thecalvinchan&apos;, u&apos;name&apos;: u&apos;Calvin Chan&apos;, u&apos;email&apos;: u&apos;calvin.chan.h@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-20019&quot; title=&quot;investigate SpiderMonkey performance degradation vs. v8&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-20019&quot;&gt;&lt;del&gt;SERVER-20019&lt;/del&gt;&lt;/a&gt; SpiderMonkey performance improvement in shell by removing pre-emptive string creation&lt;/p&gt;

&lt;p&gt;The current SpiderMonkey implementation preemptively generates a string&lt;br/&gt;
for the IdWrapper of JSid. This id-&amp;gt;std::string conversion is expensive&lt;br/&gt;
and is quite often unnecessary. By delaying the creation of the string&lt;br/&gt;
until after checking that it is absolutely necessary, we can improve&lt;br/&gt;
SpiderMonkey performance on the shell by about 20%.&lt;/p&gt;

&lt;p&gt;Signed-off-by: Adam Midvidy &amp;lt;amidvidy@gmail.com&amp;gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/d62950018b994a989dded40d677ebd578dfcf33d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/d62950018b994a989dded40d677ebd578dfcf33d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1009887" author="jason.carey" created="Wed, 19 Aug 2015 18:38:44 +0000"  >&lt;p&gt;To add in some background:&lt;/p&gt;

&lt;p&gt;It&apos;s fairly expected that id -&amp;gt; std::string conversions are expensive.  V8 used utf8 strings internally, so going in and out of javascript was fairly inexpensive (just a copy).  In comparison, spidermonkey has utf16 strings (so we have encode/decode added into the mix).&lt;/p&gt;

&lt;p&gt;If you wanted to take a stab at the particular cost center you identified, you might try delaying the:&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;// scripting/mozjs/db.cpp DBInfo::getProperty&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;std::string sname = IdWrapper(cx, id).toString();&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;Line, until after we&apos;ve identified that we don&apos;t have it already.  We&apos;re probably just making the string &quot;_db&quot; over and over again (at least looking at the bulk api).&lt;/p&gt;

&lt;p&gt;We could also probably skip making the string until after we&apos;ve checked to see if it&apos;s empty or has a leading &apos;_&apos; by just using the mozilla string functions on a JSString*&lt;/p&gt;</comment>
                            <comment id="1009871" author="margaret.stephenson" created="Wed, 19 Aug 2015 18:28:22 +0000"  >&lt;p&gt;In addition, about 14.7% of the time spent in Interpret is used by ValueWriter::toBSON, which is called by MongoBase::Functions::wrapper_find and MongoBase::Functions::wrapper_bsonsize during the Invoke stage of Interpret.&lt;/p&gt;</comment>
                            <comment id="1009864" author="calvin.chan" created="Wed, 19 Aug 2015 18:18:44 +0000"  >&lt;p&gt;Ran some basic profiling tests. In one case, running the provided function in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-19977&quot; title=&quot;30-50% performance regression in basic performance tests using mongo shell&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-19977&quot;&gt;&lt;del&gt;SERVER-19977&lt;/del&gt;&lt;/a&gt; on SpiderMonkey yielded a total running time of approx. 10 seconds.&lt;/p&gt;

&lt;p&gt;98% of the time is spent inside SpiderMonkey&apos;s Interpret function (third_party/mozjs-38/extract/js/src/vm/Interpreter.cpp). Within that it seems like the biggest culprit is the invocation of IdWrapper::toString() inside DBInfo::getProperty (mongo/scripting/mozjs/db.cpp).&lt;/p&gt;

&lt;p&gt;IdWrapper::toString is called multiple times, and for the majority of the times it contributes a significant amount to the overall running time, largely due to the construction of the mozjs::JSStringWrapper&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 19 Aug 2015 18:18:44 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        8 years, 25 weeks, 2 days 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-159</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>greg.mckeon@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            8 years, 25 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>adam.midvidy</customfieldvalue>
            <customfieldvalue>calvin.chan</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>greg.mckeon@mongodb.com</customfieldvalue>
            <customfieldvalue>margaret.stephenson</customfieldvalue>
            <customfieldvalue>mira.carey@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrkx13:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hsclxr:</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_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </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|hrtnx3:</customfieldvalue>

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