baalexander/rosnodejs — pull request #22 by temsa (2012-02-28 14:41:30+00:00)
Title: Walk into packages

Adds a helper to walk into packages, which will be more than useful to retrieve message definitions to avoid message generation.

FYI, on my laptop, here is some performance information :

```js
var package = require('./lib/packages');

//time to reach one package in my ROS_WORKSPACE
console.time('pack');
package.findPackage('turtlenode', function() {console.timeEnd('pack')})
//logs "pack: 37ms"

//time to reach the tutorial stack package 'turtlesim'
console.time('pack');
package.findPackage('turtlesim', function() {console.timeEnd('pack')})
// logs "pack: 107ms"
```

Walking algorithm may use parallelization rather than chain, but it will be pretty much more difficult to find which entry has the precedence (and to stop when the good one is retrieve) in the path if multiple package matches, and hard drives are pretty poor at parallel search (... but this is not true for flash or ssd, which may be used in robots), so it can globally slows the search if we have only one package matching the name.

We can also add some cache pretty easily (like rospack does, we can even share the cache with it), but it's not done yet