Adding Computed Relationships to CouchDB-Ember-Kit

Will Holcomb

26 June 2014

I am working on a habit tracking app. I originally wrote it using the Android SDK, but syncing the device with a server was a horrible pain. So, I am working on a rewrite in Ember.js backed by Couchbase.

Unfortunately I am running into some performance issues. The landing page is just a list of habits and the last time a reading was recorded:

{{format-time-numeric lastTime}}

The supporting model looks like:

At issue is the lastTime property. Each Selectable has a list of events. This is stored in the database as an array of identifiers. When computing the lastTime, the program has to load all the events and add them to the list. For 500 events, this is taking 30 seconds.