Skip to content

JOQULAR vs PouchDB & Others

Simon Y. Blackwell edited this page May 3, 2015 · 14 revisions

Introduction

JOQULAR is first and foremost a language for expressing queries. That being said, since the libraries associated with the reference implementation provide database like services, it is worth comparing it to more complete JavaScript databases.

JOQULAR is between 32K (Chrome) and 74K (others with shims) minified.

IndexedDB

IndexedDB is an evolving standard for browser based storage of JavaScript objects and primitives. The Mozilla Developer Network has excellent information on the topic. IndexedDB has a strong focus on transactional and non-transactional data integrity; however, it is relatively low level and only supports queries based on exact matches. All other comparisons must be done in the context of JavaScript code. The concept of classes is also missing in IndexedDB. Any data retrieved from the database must be mapped into application class instances by the programmer. In Chrome, object reads/writes are extremely fast; although index look-ups appear to be only moderately better that in memory array traversal (granted you do not have to manage a bunch of different arrays).

The JOQULAR library can optionally write objects and indexes to IndexedDB for persistence. However, it does not use the IndexedDB indexes, for each indexed class it just writes a nested object mapping object ids to their instances and another object which represents the index of all class instances. On Chrome, we have found it faster to read 100,000 simple objects into memory along with their index and conduct a JOQULAR search than it is to conduct a similar search in IndexedDB itself.

IndexedDB requires no extra files, comes with browser.

PouchDB

PouchDB provides a complete analogue to CouchDB in the browser, or on the server using node.js. In the browser, it leverages IndexedDB heavily or WebSQL if IndexedDB is not supported. In node.js it leverages LevelUP. PouchDB can also serve as a direct proxy to CouchDB to provide isomorphic client/server code with a well known, stable and understood backend, i.e. CouchDB.

Beyond IndexedDB capabilities, PouchDB adds replication, triggers, versioning, and the operators <, <=, >=, > plus others. We also find the Promise based code somewhat more approachable than IndexedDBs requests and event handlers. Although, Google has a Promise based Closure library for IndexedDB as does Arron Powell with db.js.

Although it lacks many of the database capabilities, JOQULAR has far more operators/predicates than PouchDB.

PouchDB is adopting the PouchDB Find Plugin (inspired by MongoDB). We advise you use it unless you want code-heavy map-reduce based query functionality. Like IndexedDB, indexes must be created manually and there is no built-in concept of classes. This being said, we do think PouchDB is way cool and way great if you are a CouchDB user!

PouchDB bundles all required shims to be comparable with JOQULAR with the exception of their own Find module. Total minified size is 145K + 79K = 254K.

Forerunner

Forerunner is to MongoDB as PouchDB is to CouchDB. If you are a MongoDB user looking for close to isomorphic code, this is for you. Like PouchDB, Forerunner provides drivers for IndexedDB and WebSQL and is more approachable than IndexedDB. Additionally, Forerunner adds some useful UI data-binding utilities. Also like PouchDB and IndexedDB, index specification is manual, there is no built-in concept of classes, and the operator/predicate set is somewhat limited (although far more than IndexedDB). This being said, we do think Forerunner is way cool and way great if you are a MongoDB user!

Forerunner is 154K minified.

TaffyDB

TaffyDB is similar to JOQULAR in its approach to matching patterns for database queries. If you are looking for a quick solution where persistence is not required and want something more approachable than PouchDB, Forerunner or IndexedDB, take a look. You loose transactions with TaffyDB, but you get joins ... something that is missing or convoluted in most NoSQL databases. Like JOQULAR, with TaffyDB it is trivial to add query predicates. However, for all its elegance, under the covers TaffyDB is implemented as a bunch of filters on arrays. There are no indexes, so scalability to large volumes of data may be an issue. Finally, TaffyDB development stalled about two years ago.

TaffyDB is just 17K minified.

Clone this wiki locally