Skip to content

Commit 26b0990

Browse files
committed
JS: Cache StandardEndpointFilters::isNumeric
This predicate operates on a large set of starting nodes. Caching it is easier than attempting to optimise the helper predicate `isReadFrom` without slowing down other more specialised callers of the helper predicate.
1 parent 103c8ed commit 26b0990

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/StandardEndpointFilters.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ predicate isSomeModeledArgument(DataFlow::Node n) {
5353
/**
5454
* Holds if `n` appears to be a numeric value.
5555
*/
56+
// Performance optimisation: This predicate operates on a large set of
57+
// starting nodes, so compute it only once and cache it.
58+
cached
5659
predicate isNumeric(DataFlow::Node n) { isReadFrom(n, ".*index.*") }
5760

5861
/**

0 commit comments

Comments
 (0)