
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
A simple function profiler.
The tool hooks to functions (standalone or class methods) and evaluates their execution time and if verbose mode is toggled, also prints their return type and value.
$ npm install fprofile
var profile = require('fprofile');
/**
* Adds profiling hooks to object's function(s)
* @param {Object/Function} object or function
* @param {Number} threshold, profiler will ignore execution times (in ms) below this value
* @param {Boolean} verbose mode
**/
profile(object, threshold, verbose)
Look, test.js contains a few examples:
var profile = require('./main.js');
function factorial(n) {
return n > 1 ? n * factorial(n - 1) : n;
}
var timedFunction = profile(factorial);
timedFunction(5);
timedFunction(10);
timedFunction(100);
var testObject = {
factorial: factorial,
obj: function() {
return { hello: 'world' };
}
};
profile(testObject, 0, true);
testObject.factorial(5);
testObject.obj();
profile(console);
console.log('hello');
console.log('world');
Running the code above outputs:
$ node test.js
factorial(5): 0.133ms
factorial(10): 0.02ms
factorial(100): 0.232ms
Object.factorial(5)
@time 0.194ms
@type number
@return 120
Object.obj()
@time 0.21ms
@type object
@return {"hello":"world"}
hello
Console.log("hello"): 0.375ms
world
Console.log("world"): 0.0329ms
Contribute if you want.
FAQs
Function profiler.
We found that fprofile 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.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.