New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

reds

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reds - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

73

benchmarks/index.js

@@ -6,40 +6,7 @@

var uubench = require('uubench')
, reds = require('../').createSearch('reds')
, fs = require('fs');
var reds = require('../').createSearch('reds');
var fs = require('fs');
/**
* Pad the given string.
*/
// test data
function pad(str, width) {
return Array(width - str.length + 1).join(' ') + str;
}
/**
* Global suite.
*/
suite = new uubench.Suite({
start: function(){
console.log();
},
result: function(name, stats){
var persec = 1000 / stats.elapsed
, ops = stats.iterations * persec;
console.log(' \033[90m%s : \033[36m%s \033[90mops/s\033[0m'
, pad(name, 20)
, ops | 0);
},
done: function(){
console.log();
}
});
/**
* Text bodies.
*/
var tiny = fs.readFileSync('package.json', 'utf8');

@@ -51,24 +18,20 @@ tiny = Array(5).join(tiny);

console.log();
console.log(' tiny: %dkb', (tiny.length / 1024).toFixed(2));
console.log(' small: %dkb', (small.length / 1024).toFixed(2));
console.log(' medium: %dkb', (medium.length / 1024).toFixed(2));
console.log(' large: %dmb', (large.length / 1024 / 1024).toFixed(2));
// benchmarks
suite.bench('index() tiny', function(next){
reds.index(tiny, 0, next);
});
suite('indexing', function(){
bench('tiny', function(done){
reds.index(tiny, '1234', done);
});
// suite.bench('index() small', function(next){
// reds.index(small, 0, next);
// });
bench('small', function(done){
reds.index(small, '1234', done);
});
// suite.bench('index() medium', function(next){
// reds.index(medium, 1, next);
// });
bench('medium', function(done){
reds.index(medium, '1234', done);
});
// suite.bench('index() large', function(next){
// reds.index(large, 2, next);
// });
suite.run();
bench('large', function(done){
reds.index(large, '1234', done);
});
});
{
"name": "reds"
, "version": "0.2.4"
, "description": "Redis search for node.js"
, "keywords": ["redis", "search", "metaphone", "phonetics", "natural"]
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
, "dependencies": {
"natural": "0.1.17"
, "redis": "0.7.2"
"name": "reds",
"version": "0.2.5",
"description": "Redis search for node.js",
"keywords": [
"redis",
"search",
"metaphone",
"phonetics",
"natural"
],
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"dependencies": {
"natural": "^0.2.0",
"redis": "^0.12.1"
},
"devDependencies": {
"matcha": "^0.6.0",
"should": "^3.3.2",
"superagent": "^0.21.0"
},
"main": "index",
"repository": {
"type": "git",
"url": "https://github.com/visionmedia/reds.git"
}
, "devDependencies": {
"should": "*"
, "uubench": "*"
, "superagent": "*"
}
, "main": "index"
}

@@ -45,3 +45,3 @@ # reds

By default reds performs an intersection of the search words, the previous example would yield the following output:
By default reds performs an intersection of the search words. The previous example would yield the following output since only one string contains both "Tobi" _and_ "dollars":

@@ -53,3 +53,3 @@ ```

We can tweak reds to perform a union by passing either "union" or "or" to `reds.search()` after the callback, indicating that _any_ of the constants computed may be present for the id to match.
We can tweak reds to perform a union by passing either "union" or "or" to `Search#type()` in `reds.search()` between `Search#query()` and `Search#end()`, indicating that _any_ of the constants computed may be present for the id to match.

@@ -59,2 +59,3 @@ ```js

.query(query = 'tobi dollars')
.type('or')
.end(function(err, ids){

@@ -67,6 +68,6 @@ if (err) throw err;

process.exit();
}, 'or');
});
```
The intersection would yield the following since only one string contains both "Tobi" _and_ "dollars".
The union search would yield the following since three strings contain either "Tobi" _or_ "dollars":

@@ -73,0 +74,0 @@ ```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc