Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

benchmarking

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

benchmarking - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

31

package.json
{
"name": "benchmarking",
"version": "1.1.0",
"description": "A benchmarking script that expects promises and number of iterations",
"version": "2.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha test --timeout 90000"
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/selfrefactor/benchmarking"
"url": "git+https://github.com/npm/deprecate-holder.git"
},
"keywords": [
"benchmark",
"testing",
"timing"
],
"dependencies": {
"moment": "*",
"async": "*"
},
"devDependencies": {
"unexpected": "*",
"screaper": "*",
"mocha": "*",
"bluebird": "*"
},
"author": {
"name": "self_refactor"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/selfrefactor/benchmarking/issues"
"url": "https://github.com/npm/deprecate-holder/issues"
},
"homepage": "https://github.com/selfrefactor/benchmarking"
"homepage": "https://github.com/npm/deprecate-holder#readme"
}

@@ -1,72 +0,5 @@

# benchmark-cream
# Deprecated Package
Wrap a promise and send it to loop N times and receive back a time period in seconds. Use the result for benchmarking purposes.
This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.
#Motivation
When developing some Node.js module, I wanted to check the speed of different methods. So before writing the code I intended, I decided to publish this script first.
#Example
```
var Promise = require('bluebird');
var screaper = require('screaper');
var Cream = require('./benchmark-cream');
var options = {selector: "h2", class: "entry-title", endTag: "a", length: "250"};
var giveMeOnePromise = function () {
return new Promise(function (resolve, reject) {
screaper.action('http://www.prometod.eu/en/', options).then(function (data) {
resolve(data)
}).catch(console.log)
})
};
Cream.main(100, giveMeOnePromise, function (result) {
console.log(result)
})
```
-giveMeOnePromise - a common pattern to wrap your asynchronous function with new promise
-screaper.action - thenable method under benchmarking.
#API
##main(numberLoops, giveMeOnePromise, callback)
-- numberLoops - number iterations
-- giveMeOnePromise - thenable
-- callback - it returns an object
###.time - time as a number - the period between the start and the finish of benchmarking
###.timeString - time as a string
example output - '38 seconds'
###.data - array of resolved within *giveMeOnePromise* values
For example, if you resolve a *string*, you will get array of strings
example output - [resolvedDataStep1,resolvedDataStep2, ... resolvedDataStepN]
##returnTime
same as *main* but returns only time as number
##each
same as *main* but uses *async's each* and returns time as number
##times
same as *main* but uses *async's times* and returns an array:
index 0 => time as number
index 1 => array of resolved within *giveMeOnePromise* values
#Tests
The tests file is not only show the library in actin, but also shows how cool testing is with [Unexpected](http://unexpected.js.org/).
Please contact support@npmjs.com if you have questions about this package.
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