Bug 7938

Summary: Shave .2% on PLT by removing bogus strcmp.
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: SVGAssignee: Eric Seidel (no email) <eric>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, ggaren
Priority: P4    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Remove bogus strcmp to save on plt darin: review-

Description Eric Seidel (no email) 2006-03-23 11:45:37 PST
For whatever reason we had a completely bogus strcmp in HTMLTokenizer which accounted for .2% of all time spent in the PLT (on my MBP):

@@ -901,7 +900,7 @@
                     ptr[--len] = '\0';
 
                 // Now that we've shaved off any invalid / that might have followed the name), make the tag.
-                if (ptr[0] != '!' && strcmp(ptr, "!doctype") != 0) {
+                if (ptr[0] != '!') { // make sure it's not a !DOCTYPE
                     currToken.tagName = AtomicString(ptr);
                     currToken.beginTag = beginTag;
                 }
Comment 1 Eric Seidel (no email) 2006-03-23 11:46:16 PST
Created attachment 7255 [details]
Remove bogus strcmp to save on plt
Comment 2 Geoffrey Garen 2006-03-23 12:44:55 PST
Can't "!" also be present for comment elements?
Comment 3 Darin Adler 2006-03-23 13:18:07 PST
Comment on attachment 7255 [details]
Remove bogus strcmp to save on plt

I think the right change is to change the && to a ||. We're supposed to allow tags like <!custom> I believe.
Comment 4 Eric Seidel (no email) 2006-03-23 13:28:50 PST
I had considered the ||, but hyatt and I couldn't think of any valid use case for !tagname.  I'll change it to or and add a test case for parsing a <!foo></!foo> tag.
Comment 5 Darin Adler 2006-03-23 13:56:53 PST
(In reply to comment #4)
> I had considered the ||, but hyatt and I couldn't think of any valid use case
> for !tagname.  I'll change it to or and add a test case for parsing a
> <!foo></!foo> tag.

If we're going to disallow anything starting with "!" (and Dave is definitely an authority on making that call), we should both have tests and also change the comment. I think we can do better than a comment that specifically mentions DOCTYPE and code that checks only for "!".