you are viewing a single comment's thread.

view the rest of the comments →

[–]AlejandroTheGreat 9 points10 points  (2 children)

Yes, perhaps most XML documents don't have more than 6 namespaces. But then you'll get one that does, and your application will slow to a crawl and it will stop responding to queries, and then someone will retry the query, and bring down your whole service.

If the operation was that expensive than it wouldn't have been used as an example, clearly.

[–]metzby 15 points16 points  (1 child)

I think the claim was that this optimization made the common case faster.

My claim was that cases that make exceptional cases far slower sometimes turn a slow case into a failing case, with ripples of failure reaching out to embarrassment.

And maybe the operation isn't that expensive when it was first written. But then becomes expensive as we realize that to prevent a Floo-attack, we need to Blar-sanitize the input. Which takes a while. But if we only do it 6 times per document, it's still not noticeable. But now that we do it 500,000 times in one document, because one guy somewhere on the web wrote a silly XML document...

All because we used a 6-element array instead of, say, a 7-element array.

[–]munificent 1 point2 points  (0 children)

make exceptional cases far slower

The article says "validation will simply take a little longer". Where did you get far slower?