String processing is costly, but stupidity is more costly still

Damn, this is annoying:

image

And then I find out why:

image

Stupid of me, really stupid of me.

Print | posted on Thursday, September 11, 2008 6:21 PM

Feedback


Gravatar

# re: String processing is costly, but stupidity is more costly still 9/11/2008 6:46 PM Stephen

Hah, we've all done it, having the strategy to not fully "trust" yourself and do stuff like profiling or writing tests is the redemption.. right?

Only human after all ;)


Gravatar

# re: String processing is costly, but stupidity is more costly still 9/11/2008 8:26 PM josh

been there, done that, fixed it, and had it blow up on low end machines because of garbage collection. good to know the unsleeping one is also human. (chapter 6 is good; still working on it)


Gravatar

# re: String processing is costly, but stupidity is more costly still 9/11/2008 9:15 PM Lucas Goodwin

Almost like grabbing a new collection from the DB on every loop.


Gravatar

# re: String processing is costly, but stupidity is more costly still 9/11/2008 10:40 PM Neal Blomfield

At least you caught it early, and like Stephen says doing the profiling and testing is the redemption. =)

Worked on a project (well before I knew / understood testing etc) that was supposed to rendered an image map if the number of datapoints was less than 100 (some images would have 800 or more datapoints). The code should have been if() { foreach() } but was foreach(){ if() {} } - and went to production that way.

Suffice to say clients were complaining of slow page times in very short order. * very embarrassed developer *


Gravatar

# re: String processing is costly, but stupidity is more costly still 9/12/2008 1:41 AM Bob

So, can anyone tell me what's happening here?


Gravatar

# re: String processing is costly, but stupidity is more costly still 9/12/2008 1:43 AM Art

What tool these screenshots are from?


Gravatar

# re: String processing is costly, but stupidity is more costly still 9/12/2008 11:33 AM Gary

I love your blog, but sometimes you leave us mere mortals confused and dumbfounded. Could we have a few lines of explanation, so that we can try to keep up!




Gravatar

# re: String processing is costly, but stupidity is more costly still 9/12/2008 11:50 AM Frank Quednau

Yeah, he likes to keep us in the dark. I've seen that rethorical mechanism quite a bit on diary blogs as well ;).
Like the other bits of life are too easy.
The delegate for the NotifyOnChange also walks over all urls, which the outer foreach was also doing.
In the second shot, the iteration is taken outside the foreach loop which should speed up things quite nicely.

But then I'm probably wrong.
Cheers


Gravatar

# re: String processing is costly, but stupidity is more costly still 9/12/2008 3:33 PM testb

Screenshots -> JetBrains dotTrace
engine.Cache.Whatever -> LoD?


Gravatar

# re: String processing is costly, but stupidity is more costly still 9/13/2008 12:42 AM Jan Limpens

looks like winmerge/diff to me, but i might be wrong.

anyway, there is a seemingly costly call to some engine.Storage.Nofier within a foreach loop. while it seems to have been better doing this only once, after the foreach.

but without knowing the context, this could be perfectly valid or hell breaking loose.


Gravatar

# re: String processing is costly, but stupidity is more costly still 9/23/2008 6:43 AM senthil

can someone what this is all about...

Comments have been closed on this topic.