Kirlovon / aloedb

Light, Embeddable, NoSQL database for Deno 🦕
https://deno.land/x/aloedb
MIT License
140 stars 12 forks source link

How does this compare to `denyncrawford/dndb`? #9

Closed cktang88 closed 3 years ago

cktang88 commented 3 years ago

https://github.com/denyncrawford/dndb

Kirlovon commented 3 years ago

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:

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
cktang88 commented 3 years ago

Thanks for the detailed answer!