Monday, 25 January 2010

MapReduce plug-in Release Candidate now available

The MapReduce plug-in for jQuery has been uploaded to the following url:

http://plugins.jquery.com/project/MapReduce

The plug-in implements a a type of map/reduce algorithm that executes synchronously or asynchronously in the browse whilst minimising loss in performance. Supports long running operations without script timeout messages.

Add map and reduce functions using the $.map and $.reduce methods and execute the functions using the $.execute method. Nested map and reduce functions are supported.

The download contains two samples of finding the prime numbers in a sequence of numbers, one using a plain javascript function and one using map reduce to calculate this asynchronously without causing script timeout errors in the browser.

Options

The following options can be used when calling the $.execute method:

async: true or false - determines whether the $.execute method runs asynchronously (default false)
race: no of functions to call per iteration when async is true (default 100)
interval: interval in ms between iterations when async is true (default 1ms)

No comments: