Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
nolanlawson / readme.md
Last active August 29, 2015 14:02
PouchDB performance report, June 14 2014

PouchDB performance report, June 14 2014

Summary

PouchDB 3.0.0 will be up to 77% faster than 2.2.3 for secondary index creation. Gains were made across all adapters, with the most improved being IndexedDB in Chrome.

Intro

@nolanlawson
nolanlawson / stardown.md
Last active August 29, 2015 14:02
Server-side *DOWN databases that are passing the PouchDB test suite
Database Known to pass at 100% Comments Issue
LevelDOWN Very stable
MemDOWN Somewhat stable, seems to have intermittents, can't find them now for some reason
RiakDOWN X Seems stable-ish, but needs to implement destroy() here
SqlDOWN X failing at test.design_docs.js-http Concurrent queries here
MysqlDOWN X Doesn't seem stable
RedisDOWN X Fails at test.all_docs.js-http Testing conflicts here and here
@nolanlawson
nolanlawson / tldrs.md
Last active August 29, 2015 14:02
PouchDB PR TLDRs

There are a ton related to performance, which you can probably skip for now. Those should be reviewed with a fine-toothed comb, since most performance fixes make the code harder to read, unfortunately.

pouchdb/pouchdb#2363

This one is kind of a big deal for pouchdb-server. Basically I wanted to set it up so that when we test against pouchdb-server, we don't cram all the files in the root directory (annoying during development), and in the process I discovered a bug in how the db was reporting its name in db.info. This fix makes sure that the name is the same everywhere (on('destory'), on('create'), db.info()) and is something sensible, regardless of the prefix.

pouchdb/pouchdb#2367

More pouchdb-server stuff. I think it makes sense to go ahead and merge this, even though it's failing. Gives us an excuse to make more improvements to MemDOWN.

@nolanlawson
nolanlawson / AwkwardFragment.java
Last active September 4, 2018 14:19
Avoiding non-default constructors in fragments in Android
// I want to write this:
public class WebViewFragment extends Fragment {
int mHtmlResource;
public WebViewFragment(int htmlResource) {
mHtmlResource = htmlResource;
}
@nolanlawson
nolanlawson / pouch_for_leveldown.md
Last active July 28, 2020 19:19
PouchDB for LevelDOWN authors

PouchDB for LevelDOWN authors

Introduction

Who are you? You're the author of a LevelDOWN-compatibile module, such as MemDOWN, FooDOWN, BarDOWN, whatever.

What do you want? A super-sweet module that passes the grueling 1,000+ tests in the PouchDB test suite. This guide will help get you there.

@nolanlawson
nolanlawson / index.js
Created June 25, 2014 15:38
promisy db.get
var getID = function (result) {
return result.id;
};
var db = new PouchDB('test');
return db.post({things: [1, 2, 3]})
.then(getID)
.then(function (id) {
return db.get(id);
});
@nolanlawson
nolanlawson / query_api.md
Last active August 29, 2015 14:03
Cloudant Query API - first impressions

The new Cloudant query API is pretty awesome. It basically looks like Mongo, which makes for much more readable and user-friendly queries than what you can get with standard map/reduce.

Index the field foo:

cinnabar:~ nolan$ acurl -X POST https://pouch.cloudant.com/mydb/_index -d '{
>     "index": {
>         "fields": ["foo"]
>     },
@nolanlawson
nolanlawson / index.html
Last active August 29, 2015 14:03
SQLite Plugin not as fast as I thought
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<style>
.sidebyside {
display:inline-block;
max-width: 200px;
margin: 0 30px 20px 30px;
@nolanlawson
nolanlawson / readme.md
Created July 12, 2014 02:44
Post-mortem

Quick post-mortem on this, since I think it's interesting. :)

The idea itself was excellent. By hooking into the Level* ecosystem, we got a number of different backends for free*: in-memory (both client and server), localStorage, RiakDOWN, SqlDOWN, etc.

We never did replace the IndexedDB and WebSQL adapters, though. Part of that was probably a self-fulfilling prophesy on my part, because I went to extreme lengths to get both adapters passing on Safari, IE, Android, iOS, PhantomJS, and now even the Cordova SQLite Plugin on both iOS and back to Android 2.3. Then I performance-tuned the hell out of them.

So now I think we're invested enough in idb.js and websql.js, and the performance is tuned so tightly to those specific APIs, that switching to level.js/WebDOWN/SqlDOWN would be too big a cost to bear in terms of performance (level.js is currently 2x slower). And we'd get little gain in developer efficiency, since our implementations are pretty rock-solid by now. In fact I think PouchDB may be at the forefro

@nolanlawson
nolanlawson / index.html
Created July 17, 2014 17:36
Test PouchDB Map/Reduce error 1
<html>
<body>
<script src="//cdnjs.cloudflare.com/ajax/libs/pouchdb/2.2.3/pouchdb.min.js"></script>
<script src="index.js"></script>
</body>
</html>