appy-one / acebase

A fast, low memory, transactional, index & query enabled NoSQL database engine and server for node.js and browser with realtime data change notifications
MIT License
491 stars 27 forks source link

Building index on larger collection #114

Closed donl closed 2 years ago

donl commented 2 years ago

I'm having issues building indexes with larger collections (10k items) with a single Date field.

Error building index /item//at: Maximum call stack size exceeded [idx-test] Index build on "/item//at" failed: Maximum call stack size exceeded (code: undefined) /ace-server-test/node_modules/acebase/src/data-index.js:3801 const recursiveSort = (start, end) => { ^

RangeError: Maximum call stack size exceeded at recursiveSort (/ace-server-test/node_modules/acebase/src/data-index.js:3801:25)

appy-one commented 2 years ago

I managed to reproduce this and am on it. Thanks for reporting!

appy-one commented 2 years ago

I fixed this by replacing the used quicksort algorithm with a faster variant that uses stacks instead of recursion (which was causing the stack overflow). I've published the changes in v1.21.2. Thanks again for reporting this, let me know if it works!

Also, many many thanks for sponsoring! You rock!!