@samitouri / QOS-React-2 / commits / 1c44b874fc

Remove timing metrics from Transaction

No one uses these and they weren't meant to be left in. Test Plan: jest

Ben Alpert committed Jun 23, 2014 at 20:32 UTC 1c44b874fc63287c4ae159c5701d4f785429fffa
1 file changed -32
src/utils/Transaction.js
-32
@@ -57,9 +57,6 @@ var invariant = require('invariant');
57 * +-----------------------------------------+
58 * </pre>
59 *
60 - * Bonus:
61 - * - Reports timing metrics by method name and wrapper index.
62 - *
60 * Use cases:
61 * - Preserving the input selection ranges before/after reconciliation.
62 * Restoring selection even in the event of an unexpected error.
@@ -99,20 +96,6 @@ var Mixin = {
96 } else {
97 this.wrapperInitData.length = 0;
98 }
102 - if (!this.timingMetrics) {
103 - this.timingMetrics = {};
104 - }
105 - this.timingMetrics.methodInvocationTime = 0;
106 - if (!this.timingMetrics.wrapperInitTimes) {
107 - this.timingMetrics.wrapperInitTimes = [];
108 - } else {
109 - this.timingMetrics.wrapperInitTimes.length = 0;
110 - }
111 - if (!this.timingMetrics.wrapperCloseTimes) {
112 - this.timingMetrics.wrapperCloseTimes = [];
113 - } else {
114 - this.timingMetrics.wrapperCloseTimes.length = 0;
115 - }
99 this._isInTransaction = false;
100 },
101
@@ -145,7 +128,6 @@ var Mixin = {
128 'Transaction.perform(...): Cannot initialize a transaction when there ' +
129 'is already an outstanding transaction.'
130 );
148 - var memberStart = Date.now();
131 var errorThrown;
132 var ret;
133 try {
@@ -159,8 +141,6 @@ var Mixin = {
141 ret = method.call(scope, a, b, c, d, e, f);
142 errorThrown = false;
143 } finally {
162 - var memberEnd = Date.now();
163 - this.methodInvocationTime += (memberEnd - memberStart);
144 try {
145 if (errorThrown) {
146 // If `method` throws, prefer to show that stack trace over any thrown
@@ -183,9 +163,7 @@ var Mixin = {
163
164 initializeAll: function(startIndex) {
165 var transactionWrappers = this.transactionWrappers;
186 - var wrapperInitTimes = this.timingMetrics.wrapperInitTimes;
166 for (var i = startIndex; i < transactionWrappers.length; i++) {
188 - var initStart = Date.now();
167 var wrapper = transactionWrappers[i];
168 try {
169 // Catching errors makes debugging more difficult, so we start with the
@@ -197,10 +175,6 @@ var Mixin = {
175 wrapper.initialize.call(this) :
176 null;
177 } finally {
200 - var curInitTime = wrapperInitTimes[i];
201 - var initEnd = Date.now();
202 - wrapperInitTimes[i] = (curInitTime || 0) + (initEnd - initStart);
203 -
178 if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
179 // The initializer for wrapper i threw an error; initialize the
180 // remaining wrappers but silence any exceptions from them to ensure
@@ -226,10 +200,8 @@ var Mixin = {
200 'Transaction.closeAll(): Cannot close transaction when none are open.'
201 );
202 var transactionWrappers = this.transactionWrappers;
229 - var wrapperCloseTimes = this.timingMetrics.wrapperCloseTimes;
203 for (var i = startIndex; i < transactionWrappers.length; i++) {
204 var wrapper = transactionWrappers[i];
232 - var closeStart = Date.now();
205 var initData = this.wrapperInitData[i];
206 var errorThrown;
207 try {
@@ -243,10 +215,6 @@ var Mixin = {
215 }
216 errorThrown = false;
217 } finally {
246 - var closeEnd = Date.now();
247 - var curCloseTime = wrapperCloseTimes[i];
248 - wrapperCloseTimes[i] = (curCloseTime || 0) + (closeEnd - closeStart);
249 -
218 if (errorThrown) {
219 // The closer for wrapper i threw an error; close the remaining
220 // wrappers but silence any exceptions from them to ensure that the