The DOM navigation methods (#up #down #previous #next) are today a bit slower than they could be (even if the new Selector improved them a lot). I think a lot of people often use them without any arguments (at least I do as well as in script.aculo.us). Right now the methods will recursively collect all nodes before picking out the correct one which isn't necessary if we only want the first element.
This patch will check if any index or selector was given and if neither, just return the first element found.
My simple benchmarks page showed these results:
* more than 3.5 times faster on Firefox Mac
* ~2.7 times faster on Safari 2
* almost 5 times faster on Firefox Win
* about 1.5 times faster on IE 7