Kirlovon/aloedb

How does this compare to `denyncrawford/dndb`?

Closed this issue ยท 2 comments

Hi! These two projects appeared at roughly the same time (Aloe was a bit earlier), and are not related to each other.

The main differences I noticed at the moment:

  • DnDb requires the --unstable flag. AloeDb doesn't.
  • DnDb doesn't use much RAM as they have a strictly limited buffer. AloeDb keeps a copy of the database in memory to increase speed.
  • In AloeDb all code is written by me, and is positioned more as a json objects storage. DnDb on the other hand adheres to MongoDb concepts, and uses dependencies like mongobj for it.

Benchmark:

import { Database } from 'https://deno.land/x/aloedb/mod.ts';

const db = new Database({ path: 'test.json' });

console.time('aloedb-insert');
for (let i = 0; i < 1000; i++) await db.insertOne({ foo: i });
console.timeEnd('aloedb-insert');

console.time('aloedb-find');
for (let i = 0; i < 1000; i++) await db.findOne({ foo: i });
console.timeEnd('aloedb-find');
import Datastore from 'https://deno.land/x/dndb@0.3.3/mod.ts'

const db = new Datastore({ filename: 'database.db', autoload: true })

console.time('dndb-insert');
for (let i = 0; i < 1000; i++) await db.insert({ foo: i });
console.timeEnd('dndb-insert');

console.time('dndb-find');
for (let i = 0; i < 1000; i++) await db.findOne({ foo: i });
console.timeEnd('dndb-find');

Results

> aloedb-insert: 87ms
> aloedb-find: 13ms

> dndb-insert: 568ms
> dndb-find: 7027ms

Thanks for the detailed answer!