Ayende @ Rahien

Unnatural acts on source code

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.

Comments

Stephen
09/11/2008 03:46 PM by
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 ;)

josh
09/11/2008 05:26 PM by
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)

Lucas Goodwin
09/11/2008 06:15 PM by
Lucas Goodwin

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

Neal Blomfield
09/11/2008 07:40 PM by
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 *

Bob
09/11/2008 10:41 PM by
Bob

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

Art
09/11/2008 10:43 PM by
Art

What tool these screenshots are from?

Gary
09/12/2008 08:33 AM by
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!

Frank Quednau
09/12/2008 08:50 AM by
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

testb
09/12/2008 12:33 PM by
testb

Screenshots -> JetBrains dotTrace

engine.Cache.Whatever -> LoD?

Jan Limpens
09/12/2008 09:42 PM by
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.

senthil
09/23/2008 03:43 AM by
senthil

can someone what this is all about...

Comments have been closed on this topic.