December 20, 2014 Re: std::string responsible for half the allocations in chrome | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On 12/5/14 2:17 PM, H. S. Teoh via Digitalmars-d wrote: > On Fri, Dec 05, 2014 at 10:03:38PM +0000, deadalnix via Digitalmars-d wrote: >> http://www.reddit.com/r/programming/comments/2ocmvb/stdstring_is_responsible_for_almost_half_of_all/ >> >> Looks like someone need immutable(char)[] . > > Yeah!!! String processing totally sucks in C/C++, even with clever > tricks like ropes for std::string. > > Having said that, though, D's immutable(char)[] isn't panacea either. > I've seen (well, written... *hangs head in shame*) D code that deals > with const(char)[] and needs to produce string, and as a result is a bit > too trigger-happy with .idup's. Causes lots of GC slowdown. It used to > be that you could just grep for idup to find the problem spots, but > nowadays with the to!string idiom, many of these idups could be masked > behind a nice to!string (which is harmless if the source is already > string, but it's not always immediately obvious at a glance). RCString is the solution. http://dpaste.dzfl.pl/817283c163f5 -- Andrei |
December 20, 2014 Re: std::string responsible for half the allocations in chrome | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Saturday, 20 December 2014 at 02:14:37 UTC, Andrei Alexandrescu wrote:
> RCString is the solution. http://dpaste.dzfl.pl/817283c163f5 --
How would refcounting help when the issue is const vs. immutable string slices?
David
|
December 24, 2014 Re: std::string responsible for half the allocations in chrome | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On 12/20/14 11:51 AM, David Nadlinger wrote:
> On Saturday, 20 December 2014 at 02:14:37 UTC, Andrei Alexandrescu wrote:
>> RCString is the solution. http://dpaste.dzfl.pl/817283c163f5 --
>
> How would refcounting help when the issue is const vs. immutable string
> slices?
All strings would have immutable characters. -- Andrei
|
Copyright © 1999-2021 by the D Language Foundation