Reviewed By: jvillard Differential Revision: D14616101 fbshipit-source-id: e938737a9master
parent
d805a0ddba
commit
ba42e3fa46
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2019-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
#import <CoreFoundation/CFArray.h>
|
||||
#import <CoreFoundation/CFDictionary.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint32_t UInt32;
|
||||
|
||||
typedef int32_t SInt32;
|
||||
|
||||
void array_count_linear(CFArrayRef arr) {
|
||||
int32_t count = CFArrayGetCount(arr);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
}
|
||||
}
|
||||
|
||||
void dict_count_linear(CFDictionaryRef dict) {
|
||||
int32_t count = CFDictionaryGetCount(dict);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
}
|
||||
}
|
||||
|
||||
void cf_array_create_linear(int x) {
|
||||
int arrayValues[200];
|
||||
|
||||
arrayValues[0] = 0;
|
||||
arrayValues[1] = 12;
|
||||
|
||||
/* Now we can create the CF array... */
|
||||
CFArrayRef array = CFArrayCreate((CFAllocatorRef)NULL,
|
||||
(const void**)arrayValues,
|
||||
x,
|
||||
&kCFTypeArrayCallBacks);
|
||||
|
||||
int32_t count = CFArrayGetCount(array);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
}
|
||||
}
|
||||
|
||||
void cf_array_create_copy_linear(int x) {
|
||||
int arrayValues[200];
|
||||
|
||||
CFArrayRef array = CFArrayCreateCopy((CFAllocatorRef)NULL, arrayValues);
|
||||
|
||||
int32_t count = CFArrayGetCount(array);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
}
|
||||
}
|
@ -1,2 +1,6 @@
|
||||
codetoanalyze/objc/performance/araii.m, Araii_initWithBuffer, 4, EXPENSIVE_ALLOCATION_CALL, no_bucket, ERROR, [with estimated cost 4, degree = 0]
|
||||
codetoanalyze/objc/performance/araii.m, memory_leak_raii_main, 1, EXPENSIVE_ALLOCATION_CALL, no_bucket, ERROR, [with estimated cost 5, degree = 0]
|
||||
codetoanalyze/objc/performance/cf.m, array_count_linear, 2, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 7 + 3 ⋅ arr.length + 2 ⋅ (arr.length + 1), degree = 1,{arr.length + 1},Loop at line 18, column 3,{arr.length},Loop at line 18, column 3]
|
||||
codetoanalyze/objc/performance/cf.m, cf_array_create_copy_linear, 6, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 1012, degree = 0]
|
||||
codetoanalyze/objc/performance/cf.m, cf_array_create_linear, 13, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 13 + 3 ⋅ x + 2 ⋅ (1+max(0, x)), degree = 1,{1+max(0, x)},Loop at line 41, column 3,{x},Loop at line 41, column 3]
|
||||
codetoanalyze/objc/performance/cf.m, dict_count_linear, 2, EXPENSIVE_EXECUTION_CALL, no_bucket, ERROR, [with estimated cost 7 + 3 ⋅ dict.length + 2 ⋅ (dict.length + 1), degree = 1,{dict.length + 1},Loop at line 24, column 3,{dict.length},Loop at line 24, column 3]
|
||||
|
Loading…
Reference in new issue