diff --git a/infer/src/checkers/costModels.ml b/infer/src/checkers/costModels.ml index 979174576..d0cd45d94 100644 --- a/infer/src/checkers/costModels.ml +++ b/infer/src/checkers/costModels.ml @@ -11,77 +11,68 @@ open BufferOverrunUtils.ModelEnv type model = model_env -> ret:Ident.t * Typ.t -> BufferOverrunDomain.Mem.t -> BasicCost.t -module Collections = struct - let eval_collection_length coll_exp loc inferbo_mem ~of_function = - let upper_bound = - let itv = - BufferOverrunModels.Collection.eval_collection_length coll_exp inferbo_mem - |> BufferOverrunDomain.Val.get_itv - in - match itv with Bottom -> Bounds.Bound.pinf | NonBottom itv_pure -> Itv.ItvPure.ub itv_pure - in - Bounds.NonNegativeBound.of_modeled_function of_function loc upper_bound +module type S = sig + val length : Exp.t -> BufferOverrunDomain.Mem.t -> BufferOverrunDomain.Val.t +end +module Array : S = struct + let length arr_exp inferbo_mem = + BufferOverrunModels.eval_array_locs_length + (BufferOverrunSemantics.eval_locs arr_exp inferbo_mem) + inferbo_mem +end - let n_log_n b = - let n = BasicCost.of_non_negative_bound b in - let log_n = BasicCost.of_non_negative_bound ~degree_kind:Polynomials.DegreeKind.Log b in - BasicCost.mult n log_n +module Collection : S = struct + let length coll_exp inferbo_mem = + BufferOverrunModels.Collection.eval_collection_length coll_exp inferbo_mem +end +let of_itv ~(itv : Itv.t) ~degree_kind ~of_function loc = + let upper_bound = + match itv with Bottom -> Bounds.Bound.pinf | NonBottom itv_pure -> Itv.ItvPure.ub itv_pure + in + Bounds.NonNegativeBound.of_modeled_function of_function loc upper_bound + |> BasicCost.of_non_negative_bound ~degree_kind - let sort coll_exp {location} ~ret:_ inferbo_mem = - let length = eval_collection_length coll_exp location ~of_function:"List.length" inferbo_mem in - n_log_n length +let linear exp ~of_function {integer_type_widths; location} ~ret:_ inferbo_mem = + let itv = + BufferOverrunSemantics.eval integer_type_widths exp inferbo_mem + |> BufferOverrunDomain.Val.get_itv + in + of_itv ~itv ~degree_kind:Polynomials.DegreeKind.Linear ~of_function location - let of_length_bound ~degree_kind coll_exp ~of_function {location} ~ret:_ inferbo_mem = - eval_collection_length coll_exp location inferbo_mem ~of_function - |> BasicCost.of_non_negative_bound ~degree_kind +let modeled ~of_function {pname; location} ~ret:(_, ret_typ) _ : BasicCost.t = + let callsite = CallSite.make pname location in + let path = Symb.SymbolPath.of_callsite ~ret_typ callsite in + let itv = Itv.of_modeled_path path in + of_itv ~itv ~degree_kind:Polynomials.DegreeKind.Linear ~of_function location - let copyOf size_exp {integer_type_widths; location} ~ret:_ inferbo_mem = - let upper_bound = - let itv = - BufferOverrunSemantics.eval integer_type_widths size_exp inferbo_mem - |> BufferOverrunDomain.Val.get_itv - in - match itv with Bottom -> Bounds.Bound.pinf | NonBottom itv_pure -> Itv.ItvPure.ub itv_pure - in - Bounds.NonNegativeBound.of_modeled_function "Arrays.copyOf" location upper_bound - |> BasicCost.of_non_negative_bound ~degree_kind:Polynomials.DegreeKind.Linear +module BoundsOf (Container : S) = struct + let of_length exp {location} ~ret:_ mem ~of_function ~degree_kind = + let itv = Container.length exp mem |> BufferOverrunDomain.Val.get_itv in + of_itv ~itv ~degree_kind ~of_function location - let linear = of_length_bound ~degree_kind:Polynomials.DegreeKind.Linear - let logarithmic = of_length_bound ~degree_kind:Polynomials.DegreeKind.Log -end + let linear_length = of_length ~degree_kind:Polynomials.DegreeKind.Linear -let provider_get {pname; location} ~ret:(_, ret_typ) _ : BasicCost.t = - let callsite = CallSite.make pname location in - let path = Symb.SymbolPath.of_callsite ~ret_typ callsite in - let v = - let itv = Itv.of_modeled_path path in - match itv with Bottom -> Bounds.Bound.pinf | NonBottom itv_pure -> Itv.ItvPure.ub itv_pure - in - Bounds.NonNegativeBound.of_modeled_function "Provider.get" location v - |> BasicCost.of_non_negative_bound + let logarithmic_length = of_length ~degree_kind:Polynomials.DegreeKind.Log + let n_log_n_length exp env ~ret mem ~of_function = + let log_n = logarithmic_length exp ~of_function env mem ~ret in + let n = linear_length exp ~of_function env mem ~ret in + BasicCost.mult n log_n +end module String = struct let substring_aux ~begin_idx ~end_v {integer_type_widths; location} inferbo_mem = - let upper_bound = - let begin_v = BufferOverrunSemantics.eval integer_type_widths begin_idx inferbo_mem in - let substring_itv = - Itv.minus (BufferOverrunDomain.Val.get_itv end_v) (BufferOverrunDomain.Val.get_itv begin_v) - in - match substring_itv with - | Bottom -> - Bounds.Bound.pinf - | NonBottom itv_pure -> - Itv.ItvPure.ub itv_pure + let begin_v = BufferOverrunSemantics.eval integer_type_widths begin_idx inferbo_mem in + let itv = + Itv.minus (BufferOverrunDomain.Val.get_itv end_v) (BufferOverrunDomain.Val.get_itv begin_v) in - Bounds.NonNegativeBound.of_modeled_function "String.substring" location upper_bound - |> BasicCost.of_non_negative_bound + of_itv ~itv ~degree_kind:Polynomials.DegreeKind.Linear ~of_function:"String.substring" location let substring exp begin_idx model_env ~ret:_ inferbo_mem = @@ -96,40 +87,50 @@ module String = struct model_env inferbo_mem end +module BoundsOfCollection = BoundsOf (Collection) +module BoundsOfArray = BoundsOf (Array) + module Call = struct let dispatch : (Tenv.t, model) ProcnameDispatcher.Call.dispatcher = let open ProcnameDispatcher.Call in make_dispatcher - [ +PatternMatch.implements_collections &:: "sort" $ capt_exp $+...$--> Collections.sort - ; +PatternMatch.implements_list &:: "sort" $ capt_exp $+...$--> Collections.sort + [ +PatternMatch.implements_collections + &:: "sort" $ capt_exp + $+...$--> BoundsOfCollection.n_log_n_length ~of_function:"Collections.sort" + ; +PatternMatch.implements_list &:: "sort" $ capt_exp + $+...$--> BoundsOfCollection.n_log_n_length ~of_function:"List.sort" + ; +PatternMatch.implements_arrays &:: "sort" $ capt_exp + $+...$--> BoundsOfArray.n_log_n_length ~of_function:"Arrays.sort" ; +PatternMatch.implements_list &:: "contains" <>$ capt_exp - $+...$--> Collections.linear ~of_function:"List.contains" + $+...$--> BoundsOfCollection.linear_length ~of_function:"List.contains" ; +PatternMatch.implements_collections &:: "binarySearch" <>$ capt_exp - $+...$--> Collections.logarithmic ~of_function:"Collections.binarySearch" + $+...$--> BoundsOfCollection.logarithmic_length ~of_function:"Collections.binarySearch" ; +PatternMatch.implements_arrays &:: "binarySearch" <>$ capt_exp - $+...$--> Collections.logarithmic ~of_function:"Arrays.binarySearch" + $+...$--> BoundsOfArray.logarithmic_length ~of_function:"Arrays.binarySearch" ; +PatternMatch.implements_arrays &:: "copyOf" <>$ any_arg $+ capt_exp - $+...$--> Collections.copyOf + $+...$--> linear ~of_function:"Arrays.copyOf" ; +PatternMatch.implements_collections &:: "copy" <>$ capt_exp - $+...$--> Collections.linear ~of_function:"Collections.copy" + $+...$--> BoundsOfCollection.linear_length ~of_function:"Collections.copy" ; +PatternMatch.implements_collections &:: "fill" <>$ capt_exp - $+...$--> Collections.linear ~of_function:"Collections.fill" + $+...$--> BoundsOfCollection.linear_length ~of_function:"Collections.fill" ; +PatternMatch.implements_arrays &:: "fill" <>$ capt_exp - $+...$--> Collections.linear ~of_function:"Arrays.fill" + $+...$--> BoundsOfArray.linear_length ~of_function:"Arrays.fill" ; +PatternMatch.implements_collections &:: "reverse" <>$ capt_exp - $+...$--> Collections.linear ~of_function:"Collections.reverse" + $+...$--> BoundsOfCollection.linear_length ~of_function:"Collections.reverse" ; +PatternMatch.implements_collections &:: "shuffle" <>$ capt_exp - $+...$--> Collections.linear ~of_function:"Collections.shuffle" + $+...$--> BoundsOfCollection.linear_length ~of_function:"Collections.shuffle" ; +PatternMatch.implements_lang "String" &:: "substring" <>$ capt_exp $+ capt_exp $--> String.substring ; +PatternMatch.implements_lang "String" &:: "substring" $ any_arg_of_typ (+PatternMatch.implements_lang "String") $+ capt_exp $+ capt_exp $--> String.substring_no_end - ; +PatternMatch.implements_inject "Provider" &:: "get" <>--> provider_get ] + ; +PatternMatch.implements_inject "Provider" + &:: "get" + <>--> modeled ~of_function:"Provider.get" ] end diff --git a/infer/tests/build_systems/differential_of_costs_report/fixed.exp b/infer/tests/build_systems/differential_of_costs_report/fixed.exp index 1eabb448c..55b225c19 100644 --- a/infer/tests/build_systems/differential_of_costs_report/fixed.exp +++ b/infer/tests/build_systems/differential_of_costs_report/fixed.exp @@ -1,2 +1,2 @@ -PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.f6(java.util.ArrayList):void, 0, [Updated Cost is 5 + list.length × log(list.length) (degree is 1 + 1⋅log),{list.length},call to void DiffExample.f5(ArrayList),Modeled call to List.length,{list.length},call to void DiffExample.f5(ArrayList),Modeled call to List.length] -TIME_COMPLEXITY_INCREASE_COLD_START, no_bucket, src/DiffExampleColdStart.java, DiffExampleColdStart.f6(java.util.ArrayList):void, 0, [Updated Cost is 5 + list.length × log(list.length) (degree is 1 + 1⋅log),{list.length},call to void DiffExampleColdStart.f5(ArrayList),Modeled call to List.length,{list.length},call to void DiffExampleColdStart.f5(ArrayList),Modeled call to List.length] +PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.f6(java.util.ArrayList):void, 0, [Updated Cost is 5 + list.length × log(list.length) (degree is 1 + 1⋅log),{list.length},call to void DiffExample.f5(ArrayList),Modeled call to Collections.sort,{list.length},call to void DiffExample.f5(ArrayList),Modeled call to Collections.sort] +TIME_COMPLEXITY_INCREASE_COLD_START, no_bucket, src/DiffExampleColdStart.java, DiffExampleColdStart.f6(java.util.ArrayList):void, 0, [Updated Cost is 5 + list.length × log(list.length) (degree is 1 + 1⋅log),{list.length},call to void DiffExampleColdStart.f5(ArrayList),Modeled call to Collections.sort,{list.length},call to void DiffExampleColdStart.f5(ArrayList),Modeled call to Collections.sort] diff --git a/infer/tests/build_systems/differential_of_costs_report/introduced.exp b/infer/tests/build_systems/differential_of_costs_report/introduced.exp index 45459b710..aea04238d 100644 --- a/infer/tests/build_systems/differential_of_costs_report/introduced.exp +++ b/infer/tests/build_systems/differential_of_costs_report/introduced.exp @@ -1,6 +1,6 @@ INFINITE_EXECUTION_TIME_CALL, no_bucket, src/DiffExample.java, DiffExample.f1(int):void, 0, [Unbounded loop,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 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 Collections.sort,{list.length},Modeled call to Collections.sort] INFINITE_EXECUTION_TIME_CALL, no_bucket, src/DiffExampleColdStart.java, DiffExampleColdStart.f1(int):void, 0, [Unbounded loop,Loop at line 26] TIME_COMPLEXITY_INCREASE_COLD_START, no_bucket, src/DiffExampleColdStart.java, DiffExampleColdStart.f4(int):int, 0, [Updated Cost is 6 + 5 ⋅ k (degree is 1),{k},Loop at line 45] -PERFORMANCE_VARIATION, no_bucket, src/DiffExampleColdStart.java, DiffExampleColdStart.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/DiffExampleColdStart.java, DiffExampleColdStart.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 Collections.sort,{list.length},Modeled call to Collections.sort] diff --git a/infer/tests/codetoanalyze/java/performance/Array.java b/infer/tests/codetoanalyze/java/performance/Array.java index c26c60f97..21b6a5f72 100644 --- a/infer/tests/codetoanalyze/java/performance/Array.java +++ b/infer/tests/codetoanalyze/java/performance/Array.java @@ -56,8 +56,18 @@ public class Array { } } - void fill_big_constant_FP() { + void fill_big_constant() { String[] arr = new String[300]; Arrays.fill(arr, 0); } + + void sort_array_nlogn(int size) { + String[] arr = new String[size]; + Arrays.sort(arr); + } + + void bsearch_log(int i) { + String[] arr = new String[i]; + Arrays.binarySearch(arr, "u"); + } } diff --git a/infer/tests/codetoanalyze/java/performance/issues.exp b/infer/tests/codetoanalyze/java/performance/issues.exp index 213b89689..b6d9372be 100644 --- a/infer/tests/codetoanalyze/java/performance/issues.exp +++ b/infer/tests/codetoanalyze/java/performance/issues.exp @@ -3,10 +3,12 @@ codetoanalyze/java/performance/A.java, B.error():void, 4, EXPENSIVE_ALLOCATION_C codetoanalyze/java/performance/Array.java, codetoanalyze.java.performance.Array.array_access_overrun_bad():void, 4, BUFFER_OVERRUN_L2, no_bucket, ERROR, [,Assignment,,Array declaration,Array access: Offset: [2, 8] Size: 8] codetoanalyze/java/performance/Array.java, codetoanalyze.java.performance.Array.array_access_weird_ok(long[],int):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 2 + 13 ⋅ length, degree = 1,{length},Loop at line 30] codetoanalyze/java/performance/Array.java, codetoanalyze.java.performance.Array.binary_search_log(java.lang.String[]):int, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 2 + log(arr.length), degree = 0 + 1⋅log,{arr.length},Modeled call to Arrays.binarySearch] +codetoanalyze/java/performance/Array.java, codetoanalyze.java.performance.Array.bsearch_log(int):void, 2, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 5 + log(i), degree = 0 + 1⋅log,{i},Modeled call to Arrays.binarySearch] codetoanalyze/java/performance/Array.java, codetoanalyze.java.performance.Array.copyOf_linear(java.lang.String[]):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 4 + arr.length, degree = 1,{arr.length},Modeled call to Arrays.copyOf] -codetoanalyze/java/performance/Array.java, codetoanalyze.java.performance.Array.fill_big_constant_FP():void, 0, INFINITE_EXECUTION_TIME_CALL, no_bucket, ERROR, [Unbounded loop,Modeled call to Arrays.fill] +codetoanalyze/java/performance/Array.java, codetoanalyze.java.performance.Array.fill_big_constant():void, 2, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 307, degree = 0] codetoanalyze/java/performance/Array.java, codetoanalyze.java.performance.Array.fill_linear(java.lang.String[]):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 2 + arr.length, degree = 1,{arr.length},Modeled call to Arrays.fill] codetoanalyze/java/performance/Array.java, codetoanalyze.java.performance.Array.init_array_linear():void, 2, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 2564, degree = 0] +codetoanalyze/java/performance/Array.java, codetoanalyze.java.performance.Array.sort_array_nlogn(int):void, 2, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 5 + size × log(size), degree = 1 + 1⋅log,{size},Modeled call to Arrays.sort,{size},Modeled call to Arrays.sort] codetoanalyze/java/performance/ArrayCost.java, ArrayCost.ArrayCost(int[]):void, 5, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 5 + 5 ⋅ mag.length, degree = 1,{mag.length},Loop at line 15] codetoanalyze/java/performance/ArrayCost.java, ArrayCost.isPowOfTwo_FP(int):boolean, 4, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 883, degree = 0] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.arraylist_add3_overrun_bad():void, 5, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Array declaration,Through,Through,Through,Array access: Offset added: 4 Size: 3] @@ -24,7 +26,7 @@ codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.arraylist_remov codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.arraylist_remove_overrun_bad():void, 3, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Array declaration,Through,Array access: Offset: 1 Size: 1] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.arraylist_set_overrun_bad():void, 3, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Array declaration,Through,Array access: Offset: 1 Size: 1] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.arraylist_set_underrun_bad():void, 2, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Array declaration,Array access: Offset: 0 Size: 0] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.call_sortArrayList(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 4 + list.length × log(list.length), degree = 1 + 1⋅log,{list.length},call to void ArrayListTest.sortArrayList(ArrayList),Modeled call to List.length,{list.length},call to void ArrayListTest.sortArrayList(ArrayList),Modeled call to List.length] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.call_sortArrayList(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 4 + list.length × log(list.length), degree = 1 + 1⋅log,{list.length},call to void ArrayListTest.sortArrayList(ArrayList),Modeled call to Collections.sort,{list.length},call to void ArrayListTest.sortArrayList(ArrayList),Modeled call to Collections.sort] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.constructor_add_all(java.util.ArrayList,java.util.ArrayList):void, 4, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 10 + 5 ⋅ (l.length + list.length) + 3 ⋅ (l.length + list.length + 1), degree = 1,{l.length + list.length + 1},Loop at line 245,{l.length + list.length},Loop at line 245] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.constructor_add_all_sym(java.util.ArrayList,java.util.ArrayList):void, 4, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 10 + 5 ⋅ (l.length + list.length) + 3 ⋅ (l.length + list.length + 1), degree = 1,{l.length + list.length + 1},Loop at line 252,{l.length + list.length},Loop at line 252] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.constructor_linear(java.util.ArrayList):void, 2, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 6 + 5 ⋅ list.length + 3 ⋅ (list.length + 1), degree = 1,{list.length + 1},Loop at line 227,{list.length},Loop at line 227] @@ -36,8 +38,8 @@ codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_over_lo codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_while_has_next(java.util.ArrayList):void, 3, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 4 + 10 ⋅ (list.length - 1) + 3 ⋅ list.length, degree = 1,{list.length},Loop at line 176,{list.length - 1},Loop at line 176] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_with_iterator(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 4 + 8 ⋅ (list.length - 1) + 3 ⋅ list.length, degree = 1,{list.length},Loop at line 170,{list.length - 1},Loop at line 170] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.remove_string_from_list(java.lang.String):boolean, 2, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 5 + 12 ⋅ (this.list.length - 1) + 3 ⋅ this.list.length, degree = 1,{this.list.length},Loop at line 216,{this.list.length - 1},Loop at line 216] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.sortArrayList(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 2 + list.length × log(list.length), degree = 1 + 1⋅log,{list.length},Modeled call to List.length,{list.length},Modeled call to List.length] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.sort_comparator_nlogn(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 8 + people.length × log(people.length), degree = 1 + 1⋅log,{people.length},Modeled call to List.length,{people.length},Modeled call to List.length] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.sortArrayList(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 2 + list.length × log(list.length), degree = 1 + 1⋅log,{list.length},Modeled call to Collections.sort,{list.length},Modeled call to Collections.sort] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.sort_comparator_nlogn(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 8 + people.length × log(people.length), degree = 1 + 1⋅log,{people.length},Modeled call to Collections.sort,{people.length},Modeled call to Collections.sort] codetoanalyze/java/performance/Break.java, codetoanalyze.java.performance.Break.break_constant(int):int, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 10 + 7 ⋅ p, degree = 1,{p},call to int Break.break_loop(int,int),Loop at line 12] codetoanalyze/java/performance/Break.java, codetoanalyze.java.performance.Break.break_loop(int,int):int, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 2 + 7 ⋅ p, degree = 1,{p},Loop at line 12] codetoanalyze/java/performance/Break.java, codetoanalyze.java.performance.Break.break_outer_loop_MaybeInfinite(int,int):void, 3, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 2 + 4 ⋅ maxI + 3 ⋅ maxI × (min(12, maxJ)) + 5 ⋅ maxI × (12-max(0, maxJ)) + 5 ⋅ (min(11, maxI)) × (min(11, maxJ)), degree = 2,{min(11, maxJ)},Loop at line 37,{min(11, maxI)},Loop at line 35,{12-max(0, maxJ)},Loop at line 35,{min(12, maxJ)},Loop at line 37,{maxI},Loop at line 35] @@ -129,7 +131,7 @@ codetoanalyze/java/performance/JsonUtils.java, libraries.marauder.analytics.util codetoanalyze/java/performance/JsonUtils.java, libraries.marauder.analytics.utils.json.JsonUtils.serialize(java.lang.StringBuilder,java.lang.String):void, 5, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 24 + 65 ⋅ String.toCharArray().length.ub, degree = 1,{String.toCharArray().length.ub},call to void JsonUtils.escape(StringBuilder,String),Loop at line 13] codetoanalyze/java/performance/ListTest.java, ListTest.asList_linear(java.lang.String[]):void, 2, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 7 + 8 ⋅ (array.length - 1) + 3 ⋅ array.length, degree = 1,{array.length},Loop at line 40,{array.length - 1},Loop at line 40] codetoanalyze/java/performance/ListTest.java, ListTest.indexOfImpl_linear(java.util.List,java.lang.Object):int, 2, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 4 + 11 ⋅ (list.length - 1) + 3 ⋅ list.length, degree = 1,{list.length},Loop at line 16,{list.length - 1},Loop at line 16] -codetoanalyze/java/performance/ListTest.java, ListTest.sort_comparator_nlogn(java.util.List):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 8 + people.length × log(people.length), degree = 1 + 1⋅log,{people.length},Modeled call to List.length,{people.length},Modeled call to List.length] +codetoanalyze/java/performance/ListTest.java, ListTest.sort_comparator_nlogn(java.util.List):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 8 + people.length × log(people.length), degree = 1 + 1⋅log,{people.length},Modeled call to List.sort,{people.length},Modeled call to List.sort] codetoanalyze/java/performance/ListTest.java, ListTest.sublist(java.util.List):void, 2, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 11 + 8 ⋅ (filesList.length - 2) + 3 ⋅ (filesList.length - 1), degree = 1,{filesList.length - 1},Loop at line 30,{filesList.length - 2},Loop at line 30] codetoanalyze/java/performance/Loops.java, codetoanalyze.java.performance.Loops.charsequence_length_linear(java.lang.CharSequence):void, 1, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 2 + 5 ⋅ seq.length + 3 ⋅ (seq.length + 1), degree = 1,{seq.length + 1},Loop at line 111,{seq.length},Loop at line 111] codetoanalyze/java/performance/Loops.java, codetoanalyze.java.performance.Loops.do_while_independent_of_p(int):int, 3, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 250, degree = 0]