[Cost] Avoid Top to Top performance variations

Reviewed By: ezgicicek

Differential Revision: D14342025

fbshipit-source-id: 55836b60e
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent e74b607cd0
commit defaccf032

@ -504,7 +504,8 @@ module NonNegativePolynomial = struct
let compare_by_degree = let compare_by_degree =
AbstractDomain.StackedUtils.compare ~cmp_above:TopTraces.compare ~cmp_below:(fun p1 p2 -> let cmp_above _ _ = 0 (* All Top should be considered equal *) in
AbstractDomain.StackedUtils.compare ~cmp_above ~cmp_below:(fun p1 p2 ->
Degree.compare Degree.compare
(NonNegativeNonTopPolynomial.degree p1) (NonNegativeNonTopPolynomial.degree p1)
(NonNegativeNonTopPolynomial.degree p2) ) (NonNegativeNonTopPolynomial.degree p2) )

@ -1 +1 @@
{"top":{"current":1,"previous":0},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":3,"previous":2},{"degree":100,"current":1,"previous":2},{"degree":101,"current":2,"previous":0},{"degree":200,"current":0,"previous":2}]} {"top":{"current":2,"previous":1},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":3,"previous":2},{"degree":100,"current":1,"previous":2},{"degree":101,"current":2,"previous":0},{"degree":200,"current":0,"previous":2}]}

@ -1,3 +1,3 @@
INFINITE_EXECUTION_TIME_CALL, no_bucket, src/DiffExample.java, DiffExample.f1(int):void, 0, [Loop at line 25] INFINITE_EXECUTION_TIME_CALL, no_bucket, src/DiffExample.java, DiffExample.f1(int):void, 0, [Loop at line 26]
PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.f4(int):int, 0, [Updated Cost is 6 + 5 ⋅ k (degree is 1),{k},Loop at line 44] PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.f4(int):int, 0, [Updated Cost is 6 + 5 ⋅ k (degree is 1),{k},Loop at line 45]
PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.f5(java.util.ArrayList):void, 0, [Updated Cost is 2 + list.length × log(list.length) (degree is 1 + 1⋅log),{list.length},Modeled call to List.length,{list.length},Modeled call to List.length] PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.f5(java.util.ArrayList):void, 0, [Updated Cost is 2 + list.length × log(list.length) (degree is 1 + 1⋅log),{list.length},Modeled call to List.length,{list.length},Modeled call to List.length]

@ -0,0 +1 @@
INFINITE_EXECUTION_TIME_CALL, no_bucket, src/DiffExample.java, DiffExample.f7(int):void, 0, [call to void DiffExample.f1(int),Loop at line 26]

@ -16,6 +16,7 @@ import java.util.ArrayList;
// f4: linear // f4: linear
// f5: n log n // f5: n log n
// f6: n log n // f6: n log n
// f7: top by call to f1
public class DiffExample { public class DiffExample {
@ -55,4 +56,9 @@ public class DiffExample {
private void f6(ArrayList<Integer> list) { private void f6(ArrayList<Integer> list) {
f5(list); f5(list);
} }
// cost: top by call to f1
private static void f7(int k) {
f1(k);
}
} }

@ -13,6 +13,7 @@
// f4: constant // f4: constant
// f5: linear // f5: linear
// f6: quadratic // f6: quadratic
// f7: top
public class DiffExample { public class DiffExample {
// cost: linear // cost: linear
@ -44,4 +45,12 @@ public class DiffExample {
private static void f6(int n) { private static void f6(int n) {
f2(n); f2(n);
} }
// cost: top
private static void f7(int k) {
int i = 0;
while (i >=0) {
i++;
}
}
} }

Loading…
Cancel
Save