ground-db icon indicating copy to clipboard operation
ground-db copied to clipboard

packages sizes in appcache: ground_servertime takes 375KB ??

Open hervejegou opened this issue 8 years ago • 6 comments

I use Ground:db and it works great for mobile app with offline data. I use react, react-meteor-data and the latest grounddb caching and follow instructions in v2 usage and I get offline data in my mobile app and full reactivity while connected with almost no extra work. Thanks for a great package!

I do notice that my appcache size is quite big (14MB) so I checked which packages take most space:

Package Size
ddp-client.js 581KB
blaze.js 455KB
ground_db 452KB
minimongo.js 428KB
aldeed_simple-schema.js 375KB
ground_servertime.js 353 KB

No issue with ground_db package.js size, but ground_servertime.js? I checked the repositories and I cannot understand why ground_servertime would take so much space? Code seems to be only a few lines?

Versions used:

Appcache size screenshot:

grounddb appcache sizes

hervejegou avatar Aug 06 '16 00:08 hervejegou

not sure - the latest ground db is much less code - but it relies on mozillas "localforage". The servertime though... that's like 5 lines of code,

raix avatar Aug 06 '16 05:08 raix

unless meteor bundles localforage in both bundles...

raix avatar Aug 06 '16 05:08 raix

If servertime uses localforage too, then Meteor may in fact bundle it in both packages and that would explain the significant size?

Have you considered a single package (integrate servertime in ground:db) ??

hervejegou avatar Aug 06 '16 10:08 hervejegou

Previously I had a meteor wrapper package for localforage, this would only get included once - but wanted to use the npm module directly. (assumed it would work the same...)

If you can prove that localforage is added twice I would consider it a serious issue in the meteor build tool, might be worth opening an issue there or ask in forum.meteor.com.

raix avatar Aug 06 '16 14:08 raix

I will check if I can find out more, but I am a bit new to NPM and Meteor packages. It seems that Meteor bundles each Meteor package separately in a single file which is compresses and sent to client?? so yes localforage is packaged twice probably??

Maybe to avoid these issues:

  1. you could have 3 Meteor packages?? one for ground:db, one for servertime and one for localforage (as a dependency for both?). Like this there is no danger of bundling twice...
  2. you can consider using NPM instead of Meter for distribution. This is the preferred module manager for Meteor going forward (from 1.5 onwards) so it would probably work better long term? NPM will definitely not have this problem, and having local forage as an NPM dependency means it can be used in the app by other modules also?
  3. the easiest, less effort solution short term would be to put servertime in ground:db package so there is only one package to install and no such issues?

I would be happy with 3 since servertime is 5 lines of code??

hervejegou avatar Aug 07 '16 05:08 hervejegou

Let me know if this is still an issue in 2.0.0-rc.5

raix avatar Aug 24 '16 20:08 raix