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.
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
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.