[SERVER-12132] Value::coerceToString() shouldn't unconditionally construct a stringstream Created: 16/Dec/13  Updated: 11/Jul/16  Resolved: 19/Dec/13

Status: Closed
Project: Core Server
Component/s: Aggregation Framework, Performance
Affects Version/s: None
Fix Version/s: 2.4.10, 2.5.5

Type: Improvement Priority: Major - P3
Reporter: Mathias Stearn Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

It is making $concat much slower than it should be even though the stringstream is never used in that case. Just constructing and destructing it is extremely expensive.



 Comments   
Comment by Githook User [ 09/Mar/14 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-12132 Stop using stringstream in Value::coerceToString()

This speeds up the function by two changes:
1) Using StringBuilder (through str::stream) rather than stringstream.
2) Not constructing a StringBuilder or stringstream when not needed.

At least with libstdc++, constructing and destructing a stringstream is
extremely expensive.
Branch: v2.4
https://github.com/mongodb/mongo/commit/ac5d61ca615f5028c32204f69bfd8aca7dbb152b

Comment by Githook User [ 19/Dec/13 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-12132 Stop using stringstream in Value::coerceToString()

This speeds up the function by two changes:
1) Using StringBuilder (through str::stream) rather than stringstream.
2) Not constructing a StringBuilder or stringstream when not needed.

At least with libstdc++, constructing and destructing a stringstream is
extremely expensive.
Branch: master
https://github.com/mongodb/mongo/commit/edc9da17c4abd325a85134fe5551effe8ee58977

Generated at Thu Feb 08 03:27:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.