Repository navigation
v7.6.0-beta.6
Pre-release
Pre-release
Features
- index: add a compact saved index format (7a5db23)
Performance Improvements
- index: count words once per text and cache norm ids by word count (db9d161)
Saved indexes load about 3x faster
index.serialize() saves an index in a new compact format, and Fuse.parseIndex() reads it as well as the existing toJSON() format, which is unchanged:
// Ahead of time
const saved = JSON.stringify(Fuse.createIndex(keys, list).serialize())
// At startup
const fuse = new Fuse(list, options, Fuse.parseIndex(JSON.parse(saved)))At 100k objects with 3 keys, loading a saved index takes 30 ms instead of 87 ms, and the file is 32 MB instead of 39 MB. Before this, loading a saved object index was slower than rebuilding it (54 ms); now it's about twice as fast. For plain string lists, loading saves little (6.5 ms against an 8 ms rebuild). Load the index with the same list, in the same order, as when it was saved. See saved indexes.
Faster index builds
Building an index is faster: 1.2x to 1.7x for string lists and 1.1x to 1.2x for objects, measured against 7.6.0-beta.5. Search speed and results are unchanged.