For the last couple months there have been murmurs around the office that one of our developers, Kevin Pierce, was up to something pretty amazing. Those of us who don’t know JavaScript from a jack-in-the-box were kind of left in the dark, but we were told his project had something to do with dramatically improving page load times for our application MyFrontSteps.

MyFrontSteps, to put it simply, lets you share your list of trusted home service experts with your friends. Say you’re friends with a bunch of people, and each of those people trusts a number of experts. Every time MyFrontSteps shows you a list of the experts you trust, it also needs to retrieve the list of your friends, and cross-check the friends against the experts:

Friend A trusts experts X, Y, and Z.

Friend B trusts experts X and Y.

Friend C trusts experts Y and Z.

Friend D doesn’t trust anyone.

Friend E trusts…

Now, each of these cross-checks only takes a fraction of a second, but if you’ve got a page requiring hundreds of cross-checks, those fractions can add up. By the time they’re all done, the user has spent a non-fractional number of seconds waiting for the page to load.

These cross-checks take forever when they have to be done serially – one after another. Obviously things would go much more quickly if you could conduct these operations in parallel – all at the same time. Kevin’s simple task was to find a way to make that possible.

And so he…uh…well, maybe I’d better let Jason describe what Kevin did next:

He started poking around the gory depths of the App Engine source and discovered that all of the API calls stub out in MakeSyncCall. This inevitably led to the discovery of the partner MakeCall which yields an RPC object that you can wait on. Of course, if I can wait on one RPC object, I can also wait on many of them.

What this means is…well, I really have no idea what it means. The gist is that MyFrontSteps can now do a hundred things all at once instead of painstakingly, one after the other. As a result, we can now present information in a way that it wasn’t realistically possible to do it before.

Kevin’s possibility-expanding solution has now been made available to other developers. It’s known as asynctools, and if you’re looking for a way to execute Google App Engine API calls in parallel, you’re welcome to it – it’s open source.

Because asynctools utilizes the Google App Engine API in ways that it hadn’t been utilized before, it’s drawn a little attention from the Google team. Here’s what they had to say about it on the Google App Engine Blog:

asynctools is a rather nifty toolkit that allows you to execute datastore queries in parallel in the Python runtime. The interface is slightly more involved than using standard queries, but the ability to execute multiple queries in parallel can substantially reduce the render time for a page where you need to execute multiple independent queries.

I got lost after “rather nifty”, but that’s good enough for me. Kudos to Kevin and everyone else who chipped in on this rather nifty innovation!