1
0
mirror of https://github.com/adobe/brackets.git synced 2024-11-20 09:53:00 +01:00

Add perf logging for offset calc

This commit is contained in:
Jason San Jose 2012-06-15 11:02:34 -07:00
parent fdad7dc8d5
commit 727eebd0a8
3 changed files with 11 additions and 2 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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;
}