Inefficient object handling

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Trivial - P5
    • 3.0.0
    • Affects Version/s: 2.9.2
    • Component/s: Performance
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      I was debugging through the code and noticed this inefficiency. It's probably not the only place.

      DBCollection:
      private void _checkKeys( DBObject o ) {
      for ( String s : o.keySet() ){
      validateKey ( s );
      Object inner = o.get( s );
      if ( inner instanceof DBObject )

      { _checkKeys( (DBObject)inner ); }

      else if ( inner instanceof Map )

      { _checkKeys( (Map<String, Object>)inner ); }

      }
      }
      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.

            Assignee:
            Jeffrey Yemin
            Reporter:
            Nils
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: