Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 42e075a

Browse filesBrowse files
trevnorrisrvagg
authored andcommitted
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: #2544 Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com> Reviewed-By: thefourtheye - Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent 3172e9c commit 42e075a
Copy full SHA for 42e075a

File tree

Expand file treeCollapse file tree

1 file changed

+5
-17
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-17
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-stringbytes-external.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stringbytes-external.js
+5-17Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ var c_ucs = new Buffer(b_ucs, 'ucs2');
4040
assert.equal(c_bin.length, c_ucs.length);
4141
// make sure Buffers from externals are the same
4242
for (var i = 0; i < c_bin.length; i++) {
43-
assert.equal(c_bin[i], c_ucs[i], c_bin[i] + ' == ' + c_ucs[i] +
44-
' : index ' + i);
43+
assert.equal(c_bin[i], c_ucs[i]);
4544
}
4645
// check resultant strings
4746
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;
6362
var pumped_string2 = slice2.toString('hex');
6463
var decoded = new Buffer(pumped_string, 'hex');
6564

66-
var metadata = '\nEXTERN_APEX=1031913 - pumped_string.length=';
67-
metadata += pumped_string.length + '\n';
68-
6965
// the string are the same?
7066
for (var k = 0; k < pumped_string.length; ++k) {
71-
assert.equal(pumped_string[k], pumped_string2[k],
72-
metadata + 'chars should be the same at ' + k);
67+
assert.equal(pumped_string[k], pumped_string2[k]);
7368
}
7469

7570
// the recoded buffer is the same?
7671
for (var i = 0; i < decoded.length; ++i) {
77-
assert.equal(datum[i], decoded[i],
78-
metadata + 'bytes should be the same at ' + i);
72+
assert.equal(datum[i], decoded[i]);
7973
}
8074
}
8175
})();
@@ -89,20 +83,14 @@ var PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS;
8983
var pumped_string2 = slice2.toString('base64');
9084
var decoded = new Buffer(pumped_string, 'base64');
9185

92-
var metadata = '\nEXTERN_APEX=1031913 - data=" + slice.length';
93-
metadata += ' pumped_string.length=' + pumped_string.length + '\n';
94-
9586
// the string are the same?
9687
for (var k = 0; k < pumped_string.length - 3; ++k) {
97-
assert.equal(pumped_string[k], pumped_string2[k],
98-
metadata + 'chars should be the same for two slices at '
99-
+ k + ' ' + pumped_string[k] + ' ' + pumped_string2[k]);
88+
assert.equal(pumped_string[k], pumped_string2[k]);
10089
}
10190

10291
// the recoded buffer is the same?
10392
for (var i = 0; i < decoded.length; ++i) {
104-
assert.equal(datum[i], decoded[i],
105-
metadata + 'bytes should be the same at ' + i);
93+
assert.equal(datum[i], decoded[i]);
10694
}
10795
}
10896
})();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.