Last active
August 29, 2015 14:19
-
-
Save aslushnikov/d7269e51c80c071664fa to your computer and use it in GitHub Desktop.
Estimating scirpt formatting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/Source/devtools/front_end/script_formatter_worker/ScriptFormatterWorker.js b/Source/devtools/front_end/script_formatter_worker/ScriptFormatterWorker.js | |
| index 6c8401f..50a6ae1 100644 | |
| --- a/Source/devtools/front_end/script_formatter_worker/ScriptFormatterWorker.js | |
| +++ b/Source/devtools/front_end/script_formatter_worker/ScriptFormatterWorker.js | |
| @@ -79,8 +79,10 @@ FormatterWorker.format = function(params) | |
| result.mapping = { original: [0], formatted: [0] }; | |
| result.content = FormatterWorker._formatCSS(params.content, result.mapping, 0, 0, indentString); | |
| } else { | |
| + console.time("FormatterWorker.format"); | |
| result.mapping = { original: [0], formatted: [0] }; | |
| result.content = FormatterWorker._formatScript(params.content, result.mapping, 0, 0, indentString); | |
| + console.timeEnd("FormatterWorker.format"); | |
| } | |
| postMessage(result); | |
| } | |
| diff --git a/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js b/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js | |
| index 2c76b05..b7771db 100644 | |
| --- a/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js | |
| +++ b/Source/devtools/front_end/sources/InplaceFormatterEditorAction.js | |
| @@ -78,6 +78,8 @@ WebInspector.InplaceFormatterEditorAction.prototype = { | |
| _formatSourceInPlace: function() | |
| { | |
| var uiSourceCode = this._sourcesView.currentUISourceCode(); | |
| + var timerName = String.sprintf("formatting: %s", uiSourceCode.name()); | |
| + console.time(timerName); | |
| if (!this._isFormattable(uiSourceCode)) | |
| return; | |
| @@ -113,6 +115,7 @@ WebInspector.InplaceFormatterEditorAction.prototype = { | |
| } | |
| uiSourceCode.setWorkingCopy(formattedContent); | |
| this._sourcesView.showSourceLocation(uiSourceCode, start[0], start[1]); | |
| + console.timeEnd(timerName); | |
| } | |
| }, | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment