New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: "lite" build of PouchDB with minimal features #6377

Closed
nolanlawson opened this Issue Mar 26, 2017 · 11 comments

Comments

Projects
None yet
6 participants
@nolanlawson
Copy link
Member

nolanlawson commented Mar 26, 2017

It just occurred to me that there's no need to wait for v7.0 for a smaller browser build (#6356). We can add a new package, let's call it pouchdb-browser-lite, which contains fewer packages and a more optimized build. We could even put it in pouchdb/dist as pouchdb.lite.js and pouchdb.lite.min.js.

Some things we can do in pouchdb-browser-lite:

  • no pouchdb-mapreduce
  • no pouchdb-changes-filter
  • no pouchdb-debug
  • no pouchdb-adapter-websql
  • no polyfills (Promise, Object.assign, Map, Set)
  • remove guardedConsole() (i.e. dev warnings) with a custom rollup plugin
  • remove migrations (IDB in particular)
  • etc.

We can ship this in 5.x without needing to ship any breaking changes. 😃

@nolanlawson nolanlawson added the RFC label Mar 26, 2017

@nickcolley

This comment has been minimized.

Copy link
Member

nickcolley commented Mar 27, 2017

Would be a good way to get feedback on what people would expect from a smaller build.

We'd want to make sure we don't confuse newcomers when they have a thousand and one choices though.

@nolanlawson

This comment has been minimized.

Copy link
Member

nolanlawson commented Mar 27, 2017

I think our custom build system is probably already baffling to newcomers, but it's designed for power users anyway, so hopefully newcomers will just stick with the pouchdb package.

I am worried about potential confusion from this new "lite" build, but jQuery already does a similar thing, so that gives me some confidence.

You're right though that it'd be good to ask users what they want! :)

@nolanlawson nolanlawson changed the title RFC: pouchdb-browser-lite RFC: "lite" build of PouchDB with minimal features Mar 27, 2017

@nolanlawson

This comment has been minimized.

Copy link
Member

nolanlawson commented Mar 27, 2017

BTW this PR contains some stats (#6376 (comment)) about how much we can save by removing pouchdb-mapreduce, pouchdb-changes-filter, and pouchdb-debug. It's already down from ~47KB min+gz to ~38KB, but I think we can do better.

My rough estimates of what further removals could get us:

  • no pouchdb-websql (~5KB)
  • no polyfills (~1-2KB)
  • no guardedConsole warnings (~1KB)
  • no migrations (~1KB)
  • removing XHR impl of pouchdb-ajax in favor of fetch() (~1-2KB)

So at that point we'd be looking at around 30KB which is pretty good, but still not "lite" in my opinion. Can we remove more? Other non-essentials:

  • attachments
  • PouchDB.defaults()
  • other ideas?
@nolanlawson

This comment has been minimized.

Copy link
Member

nolanlawson commented Mar 27, 2017

Question: if the package were called pouchdb-lite instead of pouchdb-browser-lite, would this be clearer? I think a lot of people avoid pouchdb-browser because the name is ambiguous, even though it's the most appropriate choice for 99% of PouchDB users (including Cordova users).

I think npm install pouchdb-lite communicates very clearly what it is. It could just be an implementation detail that it doesn't work in Node, and that those who want Node support should use pouchdb or pouchdb-node.

@garrensmith

This comment has been minimized.

Copy link
Member

garrensmith commented Mar 27, 2017

+1 on pouchdb-lite

@nolanlawson

This comment has been minimized.

Copy link
Member

nolanlawson commented Mar 28, 2017

I've got a branch where I'm testing this idea out (pouchdb-lite-2), and I'm down to 30255 bytes min+gz (92372 min) by removing migrations, XHR, BlobBuilder, polyfills, pouchdb-adapter-websql, pouchdb-mapreduce, pouchdb-debug, pouchdb-changes-filter, and guardedConsole calls. (That's compared to 47141 min+gz, 147273 min in master.)

I'm kind of surprised that I still can't crack 30KB even after removing all that stuff, but I'll keep digging to see what's still taking up space. 😕

@nolanlawson

This comment has been minimized.

Copy link
Member

nolanlawson commented Mar 28, 2017

OK, down to 29919 mingz / 91499 min by replacing immediate with Promise.resolve().then()

@nolanlawson nolanlawson referenced this issue Mar 31, 2017

Closed

Checklist for PouchDB 7.0.0 #6356

0 of 10 tasks complete
@nolanlawson

This comment has been minimized.

Copy link
Member

nolanlawson commented Apr 1, 2017

Down to 28899 / 88606 by removing pouchdb-collate and vuvuzela (pouchdb-lite-3).

@wamoyo

This comment has been minimized.

Copy link

wamoyo commented May 3, 2017

I just need to create a db, get & put docs and sync to a couchdb.

@bbuhler

This comment has been minimized.

Copy link

bbuhler commented Jun 20, 2017

I tested your pouchdb-lite package (index-es) from pouchdb-lite-3 branch with my project.
Everything still works as expected and I save up to 13kb (gz).

I have the same expectations like @wamoyo. That are definitely the basic which a lite package should contain.

I'm a fan of not having bundled polyfills and make use of modern APIs like fetch.

So I would really welcome to see that going live (:

@stale

This comment has been minimized.

Copy link

stale bot commented Nov 29, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added wontfix and removed wontfix labels Nov 29, 2017

@daleharvey daleharvey closed this Dec 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment