LokiJS - A JavaScript Database
Written by Kay Ewbank   
Tuesday, 18 November 2014

LokiJS, a lightweight JavaScript document-oriented database has reached version 1.0. An in-memory database, it prioritises performance.

 

lokijsbanner

 

LokiJS supports field indexing for faster document access and performs at near 500,000 ops/s on those. Its built-in DynamicView class also enables to utilize indexes on data subsets for even faster performance.  

 

 

The main advantage for LokiJS is a combination of the very small size (14.66KB when unzipped) and the fast performance.

Recent benchmarks indicate that its primary get() operation is about 1.4 million operations per second on a mid-range Core i5 running under node.js. The get() operation utilizes an auto generated 'id' column with its own auto generated binary index. If you’re running a Mongo-style query object, you’ll get around 20,000 ops per second under node.js, or around 500,000 ops per second if you’re querying an indexed field.

LokiJS is designed to be used for in-memory datasets, though it does persist data between sessions, and will persist data to disk when changes are made in a nodeJS, node-webkit and environments. When you want to persist data between sessions, the entire database state can be serialized as a single entity, so you can restore the state or transfer it across environments as a single JSON entity.

You can set up field indexes for faster document access, and the database includes a built-in DynamicView class that you can use to make use of indexes on data subsets. LokiJS can be used in the browser or in a node.js environment.

The developers say that LokiJS draws inspiration from MongoDB and CouchDB, in that the API is similar (but not identical or compliant) to MongoDB and you can define your own views in a CouchDB style.

The fact that new databases are still appearing in the JavaScript space highlights the fact that there’s still no clear winner in what’s a confusingly crowded sector where alternatives such as NeDB, MiniRedis, and SQL.JS all have their fans. Whether LokiJS can become a market leader remains to be seen.  

 

lokijssq

Banner


Call For Code 2024 Focuses On Generative AI
01/03/2024

This year's Call for Code challenge has been launched with a theme of the use of generative AI technology for solutions that aim to improve equitable access to resources and opportunities for historic [ ... ]



Quantum Computers Really Are A One Trick Pony
17/03/2024

Google is offering $5 million if you can think up a use for a quantum computer. Wait, I thought quantum computers were the next big thing, a revolution! Surely we know what they can do?


More News

 

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Tuesday, 18 November 2014 )