Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
perf-tester
Advanced tools
An extremely small, zero dependency module to test performance of any of your code.
An extremely small, zero dependency module to test performance of any of your code.
It uses it's own timer module to measure time taken which you can include separately in your project too.
All functions are promise based.
import { PerfTest } from 'perf-tester';
// const { PerfTest } = require('perf-tester');
const tester = new PerfTest();
callback
)Function to measure time taken for the callback function to execute. Works similar to console.time but results can be stored in a variable.
callback
- The callback function to test for.
@returns
- Time taken in miliseconds.
(async () => {
const result = await tester.measure(async () => {
// some code to test
});
// Returns time taken in ms for the code in callback to execute
console.log(result + "ms");
})();
iterations
, callback
)Executes the callback repeatetively for no. of iterations provided while measuring time taken by each callback and calculates average time taken for each.
iterations
- Number of iterations to test the callback. (Higher amount will take longer time)
callback
- The callback function to test for.
@returns
- [Object]
{
avgTimeTaken : number // Average time taken in miliseconds
,
tests : number [ ] // Array storing time taken by each test
}
(async () => {
// test the callback for 5 times
const result = await tester.testIteratively(5, async () => {
// some code to test
});
// Returns average time taken and array of time taken by each test
console.log(result);
})();
iterations
, array_of_callbacks
)Similar to testIteratively
but supports array of different callbacks to test for at once.
iterations
- Number of iterations to test the callback. (Higher amount will take longer time)
array_of_callbacks
- Array containing callbacks for whom testing should be done.
@returns
- Array containing results for each test.
(async () => {
// test the callbacks each time for 6 times
const results = await tester.batchTest(6, [
async () => {
// some code to test
},
async () => {
// some code to test
}
]);
// Array of results for each callback
console.log(results);
})();
Any suggestions are warmly welcome.
FAQs
An extremely small, zero dependency module to test performance of any of your code.
The npm package perf-tester receives a total of 0 weekly downloads. As such, perf-tester popularity was classified as not popular.
We found that perf-tester demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.