aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-stringbytes-external.js
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2015-08-17 14:32:51 -0600
committerAlexis Campailla <alexis@janeasystems.com>2015-09-01 15:08:52 -0400
commit37ee43efd5927c401aa3b51a328c199bc253715f (patch)
tree82fa17d251c5f421d542c2c63e398bf7cd633b3b /test/parallel/test-stringbytes-external.js
parent5169b516509df7a829ffb8457ac648c056f85922 (diff)
downloadandroid-node-v8-37ee43efd5927c401aa3b51a328c199bc253715f.tar.gz
android-node-v8-37ee43efd5927c401aa3b51a328c199bc253715f.tar.bz2
android-node-v8-37ee43efd5927c401aa3b51a328c199bc253715f.zip
test: improve performance of stringbytes test
String concatenation in the assert messages has drastic impact on test runtime. Removal of these messages is unlikely to affect debugging if any breaking changes are made. Previous time to run: $ time ./iojs test/parallel/test-stringbytes-external.js real 0m2.321s user 0m2.256s sys 0m0.092s With fix: $ time ./iojs test/parallel/test-stringbytes-external.js real 0m0.518s user 0m0.508s sys 0m0.008s PR-URL: https://github.com/nodejs/node/pull/2544 Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com> Reviewed-By: thefourtheye - Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to 'test/parallel/test-stringbytes-external.js')
-rw-r--r--test/parallel/test-stringbytes-external.js22
1 files changed, 5 insertions, 17 deletions
diff --git a/test/parallel/test-stringbytes-external.js b/test/parallel/test-stringbytes-external.js
index 231ab4f203..ba3f0c5d1d 100644
--- a/test/parallel/test-stringbytes-external.js
+++ b/test/parallel/test-stringbytes-external.js
@@ -40,8 +40,7 @@ var c_ucs = new Buffer(b_ucs, 'ucs2');
assert.equal(c_bin.length, c_ucs.length);
// make sure Buffers from externals are the same
for (var i = 0; i < c_bin.length; i++) {
- assert.equal(c_bin[i], c_ucs[i], c_bin[i] + ' == ' + c_ucs[i] +
- ' : index ' + i);
+ assert.equal(c_bin[i], c_ucs[i]);
}
// check resultant strings
assert.equal(c_bin.toString('ucs2'), c_ucs.toString('ucs2'));
@@ -63,19 +62,14 @@ var PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS;
var pumped_string2 = slice2.toString('hex');
var decoded = new Buffer(pumped_string, 'hex');
- var metadata = '\nEXTERN_APEX=1031913 - pumped_string.length=';
- metadata += pumped_string.length + '\n';
-
// the string are the same?
for (var k = 0; k < pumped_string.length; ++k) {
- assert.equal(pumped_string[k], pumped_string2[k],
- metadata + 'chars should be the same at ' + k);
+ assert.equal(pumped_string[k], pumped_string2[k]);
}
// the recoded buffer is the same?
for (var i = 0; i < decoded.length; ++i) {
- assert.equal(datum[i], decoded[i],
- metadata + 'bytes should be the same at ' + i);
+ assert.equal(datum[i], decoded[i]);
}
}
})();
@@ -89,20 +83,14 @@ var PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS;
var pumped_string2 = slice2.toString('base64');
var decoded = new Buffer(pumped_string, 'base64');
- var metadata = '\nEXTERN_APEX=1031913 - data=" + slice.length';
- metadata += ' pumped_string.length=' + pumped_string.length + '\n';
-
// the string are the same?
for (var k = 0; k < pumped_string.length - 3; ++k) {
- assert.equal(pumped_string[k], pumped_string2[k],
- metadata + 'chars should be the same for two slices at '
- + k + ' ' + pumped_string[k] + ' ' + pumped_string2[k]);
+ assert.equal(pumped_string[k], pumped_string2[k]);
}
// the recoded buffer is the same?
for (var i = 0; i < decoded.length; ++i) {
- assert.equal(datum[i], decoded[i],
- metadata + 'bytes should be the same at ' + i);
+ assert.equal(datum[i], decoded[i]);
}
}
})();