Bug 20346 - Speed up the JavaScript syntax highlighter by generating the finders only once
Summary: Speed up the JavaScript syntax highlighter by generating the finders only once
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Timothy Hatcher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-11 11:22 PDT by Timothy Hatcher
Modified: 2008-08-11 11:48 PDT (History)
0 users

See Also:


Attachments
Proposed patch (ignoring whitespace changes) (6.93 KB, patch)
2008-08-11 11:29 PDT, Timothy Hatcher
aroben: review+
Details | Formatted Diff | Diff
Proposed patch (full patch) (12.73 KB, patch)
2008-08-11 11:29 PDT, Timothy Hatcher
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Hatcher 2008-08-11 11:22:24 PDT
The syntax highlighter can be speed up more by generating the finders only once when syntaxHighlightJavascript is called, not per line.
Comment 1 Timothy Hatcher 2008-08-11 11:29:14 PDT
Created attachment 22730 [details]
Proposed patch (ignoring whitespace changes)
Comment 2 Timothy Hatcher 2008-08-11 11:29:52 PDT
Created attachment 22731 [details]
Proposed patch (full patch)
Comment 3 Adam Roben (:aroben) 2008-08-11 11:38:09 PDT
Comment on attachment 22730 [details]
Proposed patch (ignoring whitespace changes)

+        Removed, factoeed into syntaxHighlightJavascript as an inline function.

Typo: factoeed

-        var findSingleLineString = generateFinder(/^"(?:[^"\\]|\\.)*"|^'([^'\\]|\\.)*'/, 0, "webkit-javascript-string");
+        var findSingleLineString = generateFinder(/^"(?:[^"\\]|\\.)*"|^'([^'\\]|\\.)*'/, 0, "webkit-javascript-string"); // "

Why this change?

r=me
Comment 4 Timothy Hatcher 2008-08-11 11:47:04 PDT
(In reply to comment #3)
> (From update of attachment 22730 [details] [edit])
> -        var findSingleLineString =
> generateFinder(/^"(?:[^"\\]|\\.)*"|^'([^'\\]|\\.)*'/, 0,
> "webkit-javascript-string");
> +        var findSingleLineString =
> generateFinder(/^"(?:[^"\\]|\\.)*"|^'([^'\\]|\\.)*'/, 0,
> "webkit-javascript-string"); // "
> 
> Why this change?

Needed to keep Xcode's syntax highlighting sane. I added some words to that comment.
Comment 5 Timothy Hatcher 2008-08-11 11:48:51 PDT
Landed in r35669.