# Phase 2 gate — mongo-lite vs MongoDB 8.3.7, 1g dataset / ~16k docs # Ratio < 1.0 = mongo-lite faster. Reproduce: bash tests/e2e/compare-run.sh 1g 16k # This run includes roadmap item 1 (B+tree over the encoded keys). # Compare: tests/e2e/results/phase1.txt (pre-tree baseline). benchmark mongo-lite mongodb ratio insertOne (sequential) ×200 0.19 ms 4.1 ms 0.0x bulk insert throughput 810.4 MB/s 714.4 MB/s 1.1x docs loaded 65,536 65,536 1.0x createIndex({k: 1}) 50.8 ms 82.4 ms 0.6x countDocuments({}) 1.5 ms 13.8 ms 0.1x findOne({_id: }) 0.57 ms 0.67 ms 0.9x findOne({k: 500}) (indexed) 0.57 ms 1.8 ms 0.3x find({p: {$gte,$lt}}).count() (scan) 20.3 ms 12.9 ms 1.6x find({}).sort({_id:-1}).limit(20) 6.2 ms 2.7 ms 2.3x find({}, {proj}).limit(1000) 3.7 ms 4.5 ms 0.8x aggregate $group by k 11.5 ms 15.5 ms 0.7x updateOne({_id}) ×50 0.17 ms 0.19 ms 0.9x updateMany({k: 7}, {$inc}) 1.8 ms 6.7 ms 0.3x deleteOne({_id}) + insertOne 0.50 ms 5.0 ms 0.1x node client RSS 152 MB 156 MB 1.0x server RSS 1974 MB 1474 MB kill -9 reopen 0.8s 1.3s db on disk 1028MB 96MB # Item 1 (B+tree over encoded keys) deltas vs phase1: # updateMany 17.3 -> 1.8 ms (2.8x slower than mongod -> 3.7x faster): # entry removal was a per-entry binary search into a sorted # array with an orderedRemove memmove behind it; now it is a # descent plus a leaf-local slot removal. # createIndex 62.4 -> 50.8 ms (bulk packing replaces append+sort) # findOne(k:500) indexed 0.64 -> 0.57 ms (unchanged shape, tree search) # # Remaining gaps and where they are addressed: # db on disk 11x -> Phase 3 (block-compressed log) # sort+limit 2.3x -> Phase 2 (ordered _id index) # range-scan 1.6x -> Phase 4 (contiguous byte storage, not the matcher) # server RSS 1.3x -> Phase 4 (per-document arena -> byte storage)