Re: StringBuilder Extension: IsQuotedBy
Sébastien Lorion <[email protected]> Fri, 15 Feb 2008 10:08:03 -0500
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <[email protected]> |
Just like you cannot let someone saying allocation is expensive, I cannot let someone saying it should not be taken into account. As Frans pointed out, object destruction also need to be taken into account (yes, I consider it as part of the cost). That is one thing people seem to forget when moving to a GC environment. In C++, the whole allocation/destruction was more explicit and people were more careful usually. Just look at the original topic. The problem is to find surrounding delimiters and remove them. This can all be done easily with no allocation. Why would it be necessary to reverse the delimiter quote by creating a StringBuilder ? I don't want to nitpick on this particular "outlook compiled" code, but you see my point I hope. Rereading the posts, I don't see anyone saying that what they say is a mantra, a general guideline, whatever you want to call it. The comments were made in the context of a parser API where perf is primordial. That said, a guideline such as to do as much outside a loop as possible is common sense and very safe I would say. Sébastien On 2/15/08, Per Bolmstedt <[email protected]> wrote: > On Fri, 15 Feb 2008 09:35:39 +0100, Daniel Petersson > <[email protected]> wrote: > > > in my first post, I clearly stated that the choice (regex vs > > hand-coded) depended on the develment task, sadly a lot people > > didn't notice this and therefore a lot of post are slightly or > > completely of topic. > > > No, the reason it went OT for me is that the nonchalant statement "object > creation in .NET is expensive" has been used at least twice to support > design strategies, and subsequently gone unchallenged. And because I find > throwaway generalizations like these harmful, I can't find it within myself > to let them pass. > > And as elaboration has shown, there is *nothing* to back up this claim; one > poster has rephrased it as "object creation is expensive just like > everything is expensive" (tautology), another as "object creation is > expensive if you do it in a way that leads to expensive consequences" > (non-sequitur), etc. > > I've seen senior developers make strict guidelines forbidding certain things > on tautologies and non-sequiturs like these, so I have first-hand experience > of their dangers. > > "Thread-OT but not list-OT" is always OK, right? > > > =================================== > This list is hosted by DevelopMentor(R) http://www.develop.com > > View archives and manage your subscription(s) at http://discuss.develop.com > -- Sébastien www.sebastienlorion.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com