<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:49 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>[JAVA-675] Inefficient object handling</title>
                <link>https://jira.mongodb.org/browse/JAVA-675</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I was debugging through the code and noticed this inefficiency. It&apos;s probably not the only place.&lt;/p&gt;

&lt;p&gt;DBCollection:&lt;br/&gt;
    private void _checkKeys( DBObject o ) {&lt;br/&gt;
        for ( String s : o.keySet() ){&lt;br/&gt;
            validateKey ( s );&lt;br/&gt;
            Object inner = o.get( s );&lt;br/&gt;
            if ( inner instanceof DBObject ) &lt;/p&gt;
{
                _checkKeys( (DBObject)inner );
            }
&lt;p&gt; else if ( inner instanceof Map ) &lt;/p&gt;
{
                _checkKeys( (Map&amp;lt;String, Object&amp;gt;)inner );
            }
&lt;p&gt;        }&lt;br/&gt;
    }&lt;br/&gt;
There should be an alternative implementation that takes a Map and iterates the entry set, to avoid expensive lookup for every single key in the structure. Method _checkKeys should then start with an instanceof check and delegate to this method, if possible, which it probably will be for the vast majority of cases.&lt;/p&gt;</description>
                <environment></environment>
        <key id="54146">JAVA-675</key>
            <summary>Inefficient object handling</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="5" iconUrl="https://jira.mongodb.org/images/icons/priorities/trivial.svg">Trivial - P5</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="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="nilskp">Nils</reporter>
                        <labels>
                            <label>performance</label>
                    </labels>
                <created>Wed, 24 Oct 2012 00:46:42 +0000</created>
                <updated>Tue, 31 Mar 2015 20:10:09 +0000</updated>
                            <resolved>Fri, 12 Jul 2013 00:44:54 +0000</resolved>
                                    <version>2.9.2</version>
                                    <fixVersion>3.0.0</fixVersion>
                                    <component>Performance</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="869541" author="jeff.yemin" created="Tue, 31 Mar 2015 20:10:09 +0000"  >&lt;p&gt;Closing all resolved 3.0.0 issues, as 3.0.0 has been tagged and released.&lt;/p&gt;</comment>
                            <comment id="379447" author="jeff.yemin" created="Fri, 12 Jul 2013 00:44:34 +0000"  >&lt;p&gt;In 3.0.x, it&apos;s being done during the encoding process.  See &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/3.0.x/driver-compat/src/main/com/mongodb/codecs/DBObjectCodec.java#L77&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/blob/3.0.x/driver-compat/src/main/com/mongodb/codecs/DBObjectCodec.java#L77&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/3.0.x/driver/src/main/org/mongodb/codecs/DocumentCodec.java#L70&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/blob/3.0.x/driver/src/main/org/mongodb/codecs/DocumentCodec.java#L70&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="179814" author="jeff.yemin" created="Sat, 27 Oct 2012 03:06:32 +0000"  >&lt;p&gt;We can&apos;t do this in general since DBOBject does not implement Map.  Have you seen this show up in profiling?  Typically this kind of inefficiency does not, as I/O tends to be the bottleneck.&lt;/p&gt;</comment>
                            <comment id="178479" author="nilskp" created="Wed, 24 Oct 2012 00:48:35 +0000"  >&lt;p&gt;Or even better, wait to do such checks until binary serialization, if possible.&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|hrk71b:</customfieldvalue>

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