Re: StringBuilder Extension: IsQuotedBy
Peter Obiefuna <[email protected]> Fri, 15 Feb 2008 09:59:23 -0700
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <[email protected]> |
> Yes, I see that as one action because one cannot go without the other. > But sure, StringBuilder has more than one benefits as you and others > pointed out. > > Sébastien I am struggling with seeing object creation and destruction as "one action" ... and then speculate on overall performance based on that 'seeing'. GC work is not happening on my worker thread. It may be important in the grand scheme but that's how far am willing to go. I interpreted the original poster's use of StringBuilder as a 'given'. I imagine he's in the middle of this justifiable 'string-building' exercise and then comes upon a decision to look for delimiters. Arguing that creating StringBuilder for the sake of creating a class would be out of scope and may obfuscate the original problem. A perhaps strident note I'd rather chip in here is that programmers who target .NET CLR should focus on writing maintainable code as a major architectural ideal. For that reason, creating a few more properly refactored classes with a single-responsibility concept, in my opinion, is of higher value than than shaving off a million nanoseconds from one task. Putting this in perspective, these kinds of apps hop around networks quite much and there's much to gain from focusing on maintainable code that lays more emphasis on optimizing the way it moves around the network. P -------------------------------------------------- From: "Sébastien Lorion" <[email protected]> Sent: Friday, February 15, 2008 8:11 AM To: <[email protected]> Subject: Re: [DOTNET-CLR] StringBuilder Extension: IsQuotedBy > On 2/15/08, Frans Bouma <[email protected]> wrote: >> That initial size is to prevent memory fragmentation during >> memcpy >> actions when the buffer needs to be resized. I don't see a relevance >> with >> object creation speed and that parameter. I think the main reason the >> string >> builder is there is to avoid having lots of objects to collect. I file >> that >> kind of action under 'object destruction', not 'creation', though if you >> see >> that as one action (as creating an object means it also has to be >> collected at >> some point), you have a point. >> >> FB > > Yes, I see that as one action because one cannot go without the other. > But sure, StringBuilder has more than one benefits as you and others > pointed out. > > Sébastien > > =================================== > This list is hosted by DevelopMentor® http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com