Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Great optimization of WriteableCollection.delete().
* Vanilla keyranges on primary key will use IDBObjectStore.delete(IDBKeyRange) (BUT NOT if not on IE/Edge due to https://gist.github.com/dfahlander/5a39328f029de18222cf2125d56c38f7) This method is extremely performant on chromium at least. * Advanced queries, queries on indexes and if browser is IE/Edge: Use bulkDelete instead of delete on each iterated item. This method is still about 10 times faster on IE than deleting on each iteration. On chrome, this method is also faster, but the difference is not that big. * Prevents long-running database locks if used outside a transaction. Will split the operation into chunks with one transaction at a time to give some air to other db operations. * Prevents large memory consumption by limiting the bulk deletion to maximum 10,000 items at a time. This commit also includes the following: * Bugfix for bulkAdd() when used with syncable/observable or in other way use hook('creating'). * Added method Collection.clone() * Optimized Collection.keys() and eachKey() Closes #208
- Loading branch information