Parse.com and ScriptDB performance comparison

Lately I’ve been doing a lot of posts to do with messing around with color. I’m using a selection of technologies such as scriptDB, Parse.com, jQuery promises, Google Apps Script, Google Spreadsheets, Google Visualization API and VBA to create a series of colorscheming apis and apps.

I found that neither parse.com nor scriptdb were ideal for bulk loading of data. I hit many problems to do with execution time, throttling and so on, but once the data was loaded, I wanted to compare how they performed for data retrieval.

The test is to retrieve a few thousand rows from each of scriptDB and parse.com for from Google Apps script. We’ll also use the parse.com javascript api from a jQuery app as a benchmark.

Normalization

There are a few things that are different that I have had to normalize to be able to abstract away the database layer. A few of them are

  • Different query limits – I batch up queries to the same limit so that the number of actual accesses are comparable.
  • Throttling – You need to throttle parse when using the API for write. However for this retrieval test, it doesn’t seem to cause any issues.
  • You extend the parse object with your own class definition, but scriptDB doesn’t have that concept. Instead I use siloing to partition the scriptDB. I also write control information such as timestamps, in the same way as parse.com does.

Shared source code

In oder to ensure I’m using the same code in both Google Apps Script and javaScript, I use GAS to serve up library source code to client based javascript apps. It’s not entirely efficient but it is effective to ensure a single codebase.

The results

Here are the results to query and retrieve about 4000 rows from each of the combinations. 2-3 seconds is pretty good for this operation. There’s nothing in it between the parse.com REST API and scriptDB when used from Google Apps Script. Parse.com can be improved by using the Google Cache service as below. Using the Parse.com javaScript API from a local client is a lot slower than all the others.

The code

Here’s the tester. For the libraries and code behind all this see Excel Liberation.
function timeIt() {
  var scheme = "dulux";
  var provider = "parse";
  
  var e = {parameter:{provider:provider,scheme:scheme,useCache:false}};
  mcpher.useTimer("scheme").start("Using GAS to getting scheme " +
      e.parameter.scheme + " from " + e.parameter.provider);
  
  var r = getSomehow(e,"scheme");
  
  mcpher.useTimer("scheme").stop();
  Logger.log("found "+r.results.length+" rows in scheme " + 
      e.parameter.scheme + " using provider " + e.parameter.provider);
  Logger.log(mcpher.useTimer().report(false));
}

More color schemes

I’m looking for more color schemes. If you would like to contribute a color scheme, all I  need is the link to a Google Document with the scheme in it, like the colortable tab in this spreadsheet.

Colorschemer App

Here’s a live app built using many of the techniques described in this post. Enter a color code, try a different scheme or click on one of the palette colors to cause interaction with parse.com.

About brucemcp 225 Articles
I am a Google Developer Expert and decided to investigate Google Apps Script in my spare time. The more I investigated the more content I created so this site is extremely rich. Now, in 2019, a lot of things have disappeared or don’t work anymore due to Google having retired some stuff. I am however leaving things as is and where I came across some deprecated stuff, I have indicated it. I decided to write a book about it and to also create videos to teach developers who want to learn Google Apps Script. If you find the material contained in this site useful, you can support me by buying my books and or videos.