Content deleted Content added
Improved performance |
mNo edit summary |
||
Line 515:
return root, params
end▼
-- sorts the claims based on ranks, which is done to increase performance in certain cases;▼
-- e.g. with flags "normal+|best" given and claims stored in order "normal, normal, preferred",▼
-- then the "normal" claims would be fully processed first while the "preferred" one might be the only one returned;▼
-- after sorting, this would be "preferred, normal, normal" and the "normal" claims won't be processed▼
local rankPos▼
local ranks = {{}, {}, {}} -- preferred, normal, deprecated▼
local sorted = {}▼
for i, v in ipairs(claims) do▼
rankPos = convertRank(v.rank)▼
ranks[rankPos][#ranks[rankPos] + 1] = v▼
end▼
sorted = ranks[1]▼
sorted = mergeTables(sorted, ranks[2])▼
sorted = mergeTables(sorted, ranks[3])▼
return sorted▼
end
Line 1,074 ⟶ 1,095:
return true
▲end
▲-- sorts the claims based on ranks, which is done to increase performance in certain cases;
▲-- e.g. with flags "normal+|best" given and claims stored in order "normal, normal, preferred",
▲-- then the "normal" claims would be fully processed first while the "preferred" one might be the only one returned;
▲-- after sorting, this would be "preferred, normal, normal" and the "normal" claims won't be processed
▲function Config:sortOnRanks(claims)
▲ local rankPos
▲ local ranks = {{}, {}, {}} -- preferred, normal, deprecated
▲ local sorted = {}
▲ for i, v in ipairs(claims) do
▲ rankPos = convertRank(v.rank)
▲ ranks[rankPos][#ranks[rankPos] + 1] = v
▲ end
▲ sorted = ranks[1]
▲ sorted = mergeTables(sorted, ranks[2])
▲ sorted = mergeTables(sorted, ranks[3])
▲ return sorted
end
Line 1,777:
if claims then
-- first sort the claims on ranks for better performance
claims =
-- then iterate through the claims to collect values
|