Address slowness in Explain::getPlanSummary

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 3.4.2, 3.5.2
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Query 2017-01-23
    • 0
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      While profiling mongod under VTune, running the Queries.IntNonIdFindOn mongo-perf test with 8 threads I found that roughly 6% of the FindCmd run time is spent in Explain::getPlanSummary, generating a plan summary string. Of this 6%, 2/3rds is spent in StringBuilderImpl::appendDoubleNice(), converting index direction (in this case the number 1) from double to string.

      We should look to optimize this path, either with StringBuilder optimization or custom parsing in getPlanSummary.

      It is worth noting that changing the createIndex call in "Queries.IntNonIdFindOn" to pass a NumberInt(1) rather than the default of double reduces the cost by 50%. The remaining 50% is spent in StringBuilderImpl operator<<(int) which could be optimized for small integers as was done in our itoa() implementation.

      See attachment for VTune screenshot

            Assignee:
            James Wahlin
            Reporter:
            James Wahlin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: