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

Performances / accuracy of Recursion query #19

Open
DarkaMaul opened this issue Dec 18, 2024 · 0 comments
Open

Performances / accuracy of Recursion query #19

DarkaMaul opened this issue Dec 18, 2024 · 0 comments

Comments

@DarkaMaul
Copy link
Contributor

DarkaMaul commented Dec 18, 2024

Trying to debug some performance issues following #14 (comment)

Testing setup:

Command:

codeql database analyze --rerun --threads=-1 codeqldb-elasticsearch-817 java/src/security/Recursion/Recursion.ql --format=sarif-latest --output=recursion.sarif

Test on elasticsearch codebase version 8.17 ( I generated the DB myself).

Test 1

Without isBarrierOut: 52s

Test 2

With isBarrierOut: none() : 51.8s
Idea: Does adding isBarrierOut change anything?

Test 3

Warning: wrong predicate

Idea: Check that accessing the state is not too costly

  predicate isBarrierOut(DataFlow::Node node, FlowState state) {
     node.asExpr().(MethodCall).getCallee().getName() = state.getName()
  }

Execution time: 34s

Test 4

Idea: String comparison

predicate isBarrierOut(DataFlow::Node node, FlowState state) {
  node.asExpr().(MethodCall).getCallee().getName() > state.getName()
}

Execution time: Timeout (+ 5min)

Test 5

Warning: wrong predicate

Idea: String comparison is expensive, use integers

  predicate isBarrierOut(DataFlow::Node node, FlowState state) {
    node.asExpr().(MethodCall).getCallee().getLocation().getStartLine() = state.getLocation().getStartLine()
  }
}

Execution time: Timeout (+ 5min)

Test 6

Idea: not multiplying methods and merge barrier function

  predicate isBarrier(DataFlow::Node node, FlowState state) {
    exists(MethodCall ma |
      ma = node.asExpr() and
      (
        exists(Expr e | e = ma.getAnArgument() and e instanceof ParameterOperation) or
        ma.getCaller().getName() > state.getName()
      )
    )
  }

Execution time: Timeout (+ 5min)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant