v0.11.0
v0.11 of BlinkDB arrives with massive improvements to the query engine, specifically for limiting & sorting results.
Before
blinkdb\limit-from.ts --- lokijs is 5.00x faster than blinkdb
βββββββββββ¬ββββββββββββ¬ββββββββββββββββββββ¬ββββββββββββββββββββ¬βββββββββββ¬ββββββββββ
β (index) β name β ops/sec β Average Time (ns) β Margin β Samples β
βββββββββββΌββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββΌβββββββββββΌββββββββββ€
β 0 β 'lokijs' β 16588.13217232204 β 60284.06270288466 β 'Β±1.01%' β 8295 β
β 1 β 'blinkdb' β 3319.452529365677 β 301254.4963825986 β 'Β±3.59%' β 1668 β
βββββββββββ΄ββββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββββ΄βββββββββββ΄ββββββββββ
blinkdb\sort-id-asc.ts --- lokijs is 1.22x faster than blinkdb
βββββββββββ¬ββββββββββββ¬βββββββββββββββββββββ¬ββββββββββββββββββββ¬βββββββββββ¬ββββββββββ
β (index) β name β ops/sec β Average Time (ns) β Margin β Samples β
βββββββββββΌββββββββββββΌβββββββββββββββββββββΌββββββββββββββββββββΌβββββββββββΌββββββββββ€
β 0 β 'lokijs' β 1882.3348864078623 β 531255.0955841558 β 'Β±2.41%' β 942 β
β 1 β 'blinkdb' β 1541.504252178804 β 648716.9909434716 β 'Β±7.26%' β 771 β
βββββββββββ΄ββββββββββββ΄βββββββββββββββββββββ΄ββββββββββββββββββββ΄βββββββββββ΄ββββββββββ
After
blinkdb\limit-from.ts --- blinkdb is 3.10x faster than lokijs
βββββββββββ¬ββββββββββββ¬βββββββββββββββββββββ¬βββββββββββββββββββββ¬βββββββββββ¬ββββββββββ
β (index) β name β ops/sec β Average Time (ns) β Margin β Samples β
βββββββββββΌββββββββββββΌβββββββββββββββββββββΌβββββββββββββββββββββΌβββββββββββΌββββββββββ€
β 0 β 'blinkdb' β 50585.49415326716 β 19768.513024111937 β 'Β±8.57%' β 25293 β
β 1 β 'lokijs' β 16296.938372072096 β 61361.218725211 β 'Β±2.90%' β 8156 β
βββββββββββ΄ββββββββββββ΄βββββββββββββββββββββ΄βββββββββββββββββββββ΄βββββββββββ΄ββββββββββ
blinkdb\sort-id-asc.ts --- blinkdb is 2.61x faster than lokijs
βββββββββββ¬ββββββββββββ¬βββββββββββββββββββββ¬βββββββββββββββββββββ¬βββββββββββ¬ββββββββββ
β (index) β name β ops/sec β Average Time (ns) β Margin β Samples β
βββββββββββΌββββββββββββΌβββββββββββββββββββββΌβββββββββββββββββββββΌβββββββββββΌββββββββββ€
β 0 β 'blinkdb' β 4057.786560018582 β 246439.77331213318 β 'Β±7.94%' β 2029 β
β 1 β 'lokijs' β 1557.6211865036469 β 642004.6213191763 β 'Β±2.88%' β 779 β
βββββββββββ΄ββββββββββββ΄βββββββββββββββββββββ΄βββββββββββββββββββββ΄βββββββββββ΄ββββββββββ
Implementation details
BlinkDB achieves this massive speedup by exploiting certain edge cases in queries:
- In previous implementations, limiting results with
from
was performed after all items were retrieved from the underlying btree.from
is now respected directly in the btree in all cases where where the query engine uses the primary column for item retrieval. - Sorting items can be entirely skipped if the query engine retrieved items from the primary column, since the Btree already returns the items sorted.