From af14f69a077109e25fd7e17212f8cf90533275ce Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 29 Nov 2011 15:11:40 -0500 Subject: [PATCH] performance boost in finding matchign spec lines --- vendor/assets/coffeescripts/headless_reporter_result.coffee | 2 ++ vendor/assets/javascripts/headless_reporter_result.js | 1 + 2 files changed, 3 insertions(+) diff --git a/vendor/assets/coffeescripts/headless_reporter_result.coffee b/vendor/assets/coffeescripts/headless_reporter_result.coffee index 0c8e752..7945ad8 100644 --- a/vendor/assets/coffeescripts/headless_reporter_result.coffee +++ b/vendor/assets/coffeescripts/headless_reporter_result.coffee @@ -43,4 +43,6 @@ class window.HeadlessReporterResult if index > bestChoice.accuracy bestChoice = { accuracy: index, file: file, lineNumber: lineNumber } + break if index == splitName.length + bestChoice diff --git a/vendor/assets/javascripts/headless_reporter_result.js b/vendor/assets/javascripts/headless_reporter_result.js index 3ffc20f..3d71200 100644 --- a/vendor/assets/javascripts/headless_reporter_result.js +++ b/vendor/assets/javascripts/headless_reporter_result.js @@ -70,6 +70,7 @@ lineNumber: lineNumber }; } + if (index === splitName.length) break; } return bestChoice; };