Skip to content

Commit

Permalink
chore: RCTConvert - allocate array with capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
vonovak authored Nov 26, 2022
1 parent ca1ae5c commit e91fe36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/TypeSafety/RCTConvertHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using LazyVector = FB::LazyVector<T, id>;
template <typename ContainerT>
NSArray *RCTConvertVecToArray(const ContainerT &vec, id (^convertor)(typename ContainerT::value_type element))
{
NSMutableArray *array = [NSMutableArray new];
NSMutableArray *array = [[[NSMutableArray alloc] initWithCapacity:vec.size()];
for (size_t i = 0, size = vec.size(); i < size; ++i) {
id object = convertor(vec[i]);
array[i] = object ?: (id)kCFNull;
Expand Down

0 comments on commit e91fe36

Please sign in to comment.