Skip to content

Commit

Permalink
Changing iree_vm_list_resize to grow by 2x. (#5270)
Browse files Browse the repository at this point in the history
This prevents bad push behavior leading to many reallocs.
  • Loading branch information
benvanik authored Mar 31, 2021
1 parent bd9a113 commit df454f4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion iree/vm/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ iree_vm_list_resize(iree_vm_list_t* list, iree_host_size_t new_size) {
list->count = new_size;
} else if (new_size > list->capacity) {
// Extending beyond capacity.
IREE_RETURN_IF_ERROR(iree_vm_list_reserve(list, new_size));
IREE_RETURN_IF_ERROR(iree_vm_list_reserve(
list, iree_max(list->capacity * 2, iree_align(new_size, 64))));
}
list->count = new_size;
return iree_ok_status();
Expand Down

0 comments on commit df454f4

Please sign in to comment.