webdb icon indicating copy to clipboard operation
webdb copied to clipboard

Bundle size is a bit too big

Open pfrazee opened this issue 8 years ago • 2 comments

A design tradeoff for WebDB that I didn't consider enough was bundle size.

  • [x] In the most recent release, JSON-Schema was added for validation. Turns out my module choice (ajv) adds 200kb to the output bundle (unminified).
  • [ ] The level.js choice probably adds another 300-400kb.

It'd be relatively easily to remove JSON Schema and replace it with a validation function. That function could even be implemented downstream using JSON Schema! But it'd be up to the app dev. EDIT done.

Removing level.js would be significantly harder.

pfrazee avatar Dec 14 '17 00:12 pfrazee

I'm going to remove JSON-Schema because it also presents problems for JSON-LD.

JSON-LD has a concept of multiple equivalent object structures/forms, including "compact" vs "expanded" forms. Multiple compact forms can be semantically equivalent, but take different forms. That makes JSON-Schema a little awkward.

Since it's so easy to make JSON-Schema a downstream choice by the dev, I think that'll be the smart choice.

pfrazee avatar Jan 02 '18 19:01 pfrazee

You might also checkout JSON-LD Framing--which can help if/when you need JSON Schema. However, 👍 to leaving it as a "downstream choice." There are many cases where you actually don't want validation, and layering it in (PouchDB and Apache CouchDB style--either write time, read time or both) is probably best.

Also, you might enjoy this discussion: https://lists.w3.org/Archives/Public/public-linked-json/2017Oct/thread.html

BigBlueHat avatar Jan 26 '18 21:01 BigBlueHat