This is more of a TODO than an issue, but calling addItems on a small index will force us to resize the index implicitly to fit the additional rows. This is convenient, but calling addItems over and over again causes frequent resizes, which are extremely slow and "block the world."
Instead, we should consider doing one of the following options when addItems will push us over the limit:
- Resize the index by a certain percentage (i.e.: add 10%) instead of just trying to fit the new elements
- Throw an exception if the index is too small, forcing the caller to manually call
resize
- Make both of the above options possible by adding a
resize_policy attribute to Index and choosing its default value based on the index size or other properties
cc @dylanrb123
This is more of a TODO than an issue, but calling
addItemson a small index will force us to resize the index implicitly to fit the additional rows. This is convenient, but callingaddItemsover and over again causes frequent resizes, which are extremely slow and "block the world."Instead, we should consider doing one of the following options when
addItemswill push us over the limit:resizeresize_policyattribute toIndexand choosing its default value based on the index size or other propertiescc @dylanrb123