Bug 7938 - Shave .2% on PLT by removing bogus strcmp.
Summary: Shave .2% on PLT by removing bogus strcmp.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P4 Normal
Assignee: Eric Seidel (no email)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-23 11:45 PST by Eric Seidel (no email)
Modified: 2006-03-28 14:07 PST (History)
2 users (show)

See Also:


Attachments
Remove bogus strcmp to save on plt (1.65 KB, patch)
2006-03-23 11:46 PST, Eric Seidel (no email)
darin: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 "!".