Skip to content

Commit

Permalink
Great optimization of WriteableCollection.delete().
Browse files Browse the repository at this point in the history
* 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
dfahlander committed Mar 31, 2016
1 parent 858fe7e commit 9ad2018
Show file tree
Hide file tree
Showing 4 changed files with 285 additions and 83 deletions.

0 comments on commit 9ad2018

Please sign in to comment.