Dexie.js: Collection.modify() modifies objects in bulk

Created on 22 Oct 2020  路  5Comments  路  Source: dfahlander/Dexie.js

I see that Collection.modify() modifies objects in bulk with a maximum limit of 2000. I'd like to be able to pass the maximum limit to Collection.modify() because in my case the supplied changes function performs a heavy task.

feature request

All 5 comments

The reason for chunking modify is for performance of heavy workloads so that if you must modify 100,000 rows, it will perform it in chunks of 2000. It's not a limit, just memory-saving feature that makes modify work with large workloads.

That makes sense, but would it be possible to change the size of chunks by passing a value to modify()? In my case, it affects DOM rendering for a bit and I also get a violation warning ([Violation] 'success' handler took 766ms).

Thanks for the great library!

Ok I understand. It would be a small change to allow it in the options passed to Dexie constructor. I created a PR #1153 that adds the option {modifyChunkSize: number} to the options argument in Dexie constructor. The branch is fr1152-configurable-chunksize.

Please try that version and see how it affects your use case. It would be interesting to get feedback on it. To replace your imported dexie with the one from the branch, follow the instruction in Dexie's README on how to build a clone of Dexie's source and npm link to it, but do a git checkout fr1152-configurable-chunksize before calling npm run build.

Thank you for adding this! I have tested it out with a smaller chunk size of 100 and it worked well for me.

Thanks! It's no breaking change so I think I can get it into the next RC.

Was this page helpful?
0 / 5 - 0 ratings