diff --git a/src/extensions/disabled/JavaScriptInlineEditor/JSUtils.js b/src/extensions/disabled/JavaScriptInlineEditor/JSUtils.js index 45b0aab6c..04b1f0791 100644 --- a/src/extensions/disabled/JavaScriptInlineEditor/JSUtils.js +++ b/src/extensions/disabled/JavaScriptInlineEditor/JSUtils.js @@ -118,9 +118,13 @@ define(function (require, exports, module) { functions.forEach(function (funcEntry) { if (funcEntry.offsetEnd < 0) { + PerfUtils.markStart(PerfUtils.JSUTILS_END_OFFSET); + funcEntry.offsetEnd = _getFunctionEndOffset(text, funcEntry.offsetStart); funcEntry.lineStart = StringUtils.offsetToLineNum(lines, funcEntry.offsetStart); funcEntry.lineEnd = StringUtils.offsetToLineNum(lines, funcEntry.offsetEnd); + + PerfUtils.addMeasurement(PerfUtils.JSUTILS_END_OFFSET); } rangeResults.push({ @@ -333,6 +337,7 @@ define(function (require, exports, module) { PerfUtils.createPerfMeasurement("JSUTILS_GET_ALL_FUNCTIONS", "Parallel file search across project"); PerfUtils.createPerfMeasurement("JSUTILS_REGEXP", "RegExp search for all functions"); + PerfUtils.createPerfMeasurement("JSUTILS_END_OFFSET", "Find end offset for a single matched function"); exports._findAllMatchingFunctionsInText = _findAllMatchingFunctionsInText; // For testing only exports.findMatchingFunctions = findMatchingFunctions; diff --git a/src/extensions/disabled/JavaScriptInlineEditor/unittests.js b/src/extensions/disabled/JavaScriptInlineEditor/unittests.js index c91a1ba16..80afdb3ef 100644 --- a/src/extensions/disabled/JavaScriptInlineEditor/unittests.js +++ b/src/extensions/disabled/JavaScriptInlineEditor/unittests.js @@ -650,6 +650,7 @@ define(function (require, exports, module) { PerformanceReporter.logTestWindow(PerfUtils.DOCUMENT_MANAGER_GET_DOCUMENT_FOR_PATH, "Document creation during this search", "sum"); PerformanceReporter.logTestWindow(PerfUtils.JSUTILS_REGEXP, null, "sum"); PerformanceReporter.logTestWindow(PerfUtils.JSUTILS_GET_ALL_FUNCTIONS); + PerformanceReporter.logTestWindow(PerfUtils.JSUTILS_END_OFFSET, null, "sum"); PerformanceReporter.logTestWindow(PerfUtils.JAVASCRIPT_FIND_FUNCTION); PerformanceReporter.logTestWindow(PerfUtils.JAVASCRIPT_INLINE_CREATE); PerformanceReporter.clearTestWindow(); diff --git a/test/perf/PerformanceReporter.js b/test/perf/PerformanceReporter.js index 44a9331dd..8502f1b66 100644 --- a/test/perf/PerformanceReporter.js +++ b/test/perf/PerformanceReporter.js @@ -61,8 +61,11 @@ define(function (require, exports, module) { printName = printName + " - " + name; } - if ((operation === "sum") && (Array.isArray(value))) { - value = value.reduce(function (a, b) { return a + b; }); + if (operation === "sum") { + if (Array.isArray(value)) { + value = value.reduce(function (a, b) { return a + b; }); + } + printName = "Sum of all " + printName; }