Verified Commit cfd29ecb authored by Aral Balkan's avatar Aral Balkan
Browse files

Update performance example to use new syntax; update readme

parent a6c6117b
......@@ -622,7 +622,7 @@ The reason JSDB is fast is because it keeps the whole database in memory. Also,
Initial load time and full table write/compaction both exhibit O(N) time complexity.
For example, here’s just one sample from a development laptop using the simple performance example in the examples folder which creates random records around ~2KB in size each:
For example, here’s just one sample from a development laptop using the simple performance example in the `examples/performance` folder of the source code which creates random records that are around ~2KB in size each:
| Number of records | Table size on disk | Memory used | Initial load time | Full table write/compaction time |
| ----------------- | ------------------ | ----------- | ----------------- | -------------------------------- |
......
......@@ -3,12 +3,10 @@ const { performance } = require('perf_hooks')
const process = require('process')
const Time = require('../../lib/Time')
const fs = require('fs-extra')
const path = require('path')
const faker = require('faker')
let generate = false
let numberOfRecordsToGenerate = 10000
let numberOfRecordsToGenerate = 1000
if (process.argv.length > 2) {
if (process.argv[2] === 'generate') {
......@@ -32,14 +30,14 @@ if (generate) {
e = performance.now()
console.log(`Dummy data generation took ${e-s} ms for ${numberOfRecordsToGenerate} records.`)
db = new JSDB('db', { deleteIfExists: true })
db = JSDB.open('db', { deleteIfExists: true })
s = performance.now()
db.accounts = data
e = performance.now()
console.log(`Database initialisation took ${e-s} ms for ${numberOfRecordsToGenerate} records.`)
} else {
db = new JSDB('db')
db = JSDB.open('db')
}
console.log('\n=== Testing property access. ===\n')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment