提交 17eec143 编写于 作者: B bors

Auto merge of #80569 - notriddle:patch-3, r=jyn514

Use Array.prototype.filter instead of open-coding

Part of #79052, originally suggested in https://github.com/rust-lang/rust/pull/79052#discussion_r523468743 by `@jyn514`

Besides making main.js smaller (always a plus), this also performs better by using the optimized filter implementation in your browser's JavaScript engine (according to `@GuillaumeGomez,` an 84% performance improvement).
......@@ -667,13 +667,7 @@ function defocusSearchBar() {
results = {}, results_in_args = {}, results_returned = {},
split = valLower.split("::");
var length = split.length;
for (var z = 0; z < length; ++z) {
if (split[z] === "") {
split.splice(z, 1);
z -= 1;
}
}
split = split.filter(function(segment) { return segment !== ""; });
function transformResults(results, isType) {
var out = [];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册