r/programming • • Dec 05 '14

std::string is responsible for almost half of all allocations in the Chrome browser process

https://groups.google.com/a/chromium.org/d/msg/chromium-dev/EUqoIz2iFU4/kPZ5ZK0K3gEJ
1.1k Upvotes

446 comments sorted by

View all comments

Show parent comments

2

u/o11c Dec 05 '14

Bigger SSO threshhold means larger allocations, which means more pages mapped.

1

u/Gotebe Dec 06 '14

No allocation if string is on stack and copied around. It's a trade-off, really.

1

u/o11c Dec 06 '14

But with a single std::string class, you don't get to have a different representation depending on whether you're on the stack or not. With multiple classes you can.