Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slightly speed up the all filter operator #7702

Merged
merged 1 commit into from
Sep 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions core/modules/filters/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ function getAllFilterOperators() {
Export our filter function
*/
exports.all = function(source,operator,options) {
// Get our suboperators
var allFilterOperators = getAllFilterOperators();
// Cycle through the suboperators accumulating their results
var results = new $tw.utils.LinkedList(),
subops = operator.operand.split("+");
// Check for common optimisations
var subops = operator.operand.split("+");
if(subops.length === 1 && subops[0] === "") {
return source;
} else if(subops.length === 1 && subops[0] === "tiddlers") {
Expand All @@ -46,6 +42,10 @@ exports.all = function(source,operator,options) {
return options.wiki.eachShadowPlusTiddlers;
}
// Do it the hard way
// Get our suboperators
var allFilterOperators = getAllFilterOperators();
// Cycle through the suboperators accumulating their results
var results = new $tw.utils.LinkedList();
for(var t=0; t<subops.length; t++) {
var subop = allFilterOperators[subops[t]];
if(subop) {
Expand Down