I'm having great fun pouring over your library. It is very well written and I'm learning a lot about functional programming from reading the source.

Regarding speed, you can improve performance by giving up your favourite idiom:

var args = [].slice.call(arguments, 0);

This is expensive because it creates a new Array object every time you slice an arguments object. Which is very often.

Mozilla provides a static slice method on the Array object. Or you can fake it yourself:

if (!Array.slice) { // Mozilla already supports this
Array.slice = function(array) {
// Slice an array-like object.
var slice = Array.prototype.slice;
return slice.apply(array, slice.call(arguments, 1));
};
}

And use it like this:

var args0 = Array.slice(arguments); // cast to Array
var args1 = Array.slice(arguments, 1); // a normal slice

I use it so often I make it global.

var slice = Array.slice;
var args = slice(arguments);

Hope that helps. Back to reading your source code for me. :)

Reply

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
3 + 3 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.