
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
node-measure
Advanced tools
A far better replacement for console.time along with other cool features.
Looking for a reliable way to accurately test performance of your code ? Well node-measure
is the answer (More accurate than console.time).
import { Measure } from 'node-measure';
// const { Measure } = require('node-measure');
const m = new Measure();
label
)Similar to
console.time(label)
Starts a timer with the label
provided. If not provided, default
label will be used.
label
, simplified
)Similar to
console.timeEnd(label)
, but...
It returns the time elapsed since the timer with that label was started, which can be saved into a variable, unlike outputting results into the console directly. simplified
parameter is optional and is true
by default. If it's true it returns the time elapsed in form of human-readable seconds or milliseconds accordingly, else returns in raw nanoseconds.
m.startTimer();
// some code
const end = m.endTimer();
console.log(end);
Multiple timers can be created using unique labels.
These functions are completely promise-based.
Note :
simplified
parameter is optional and istrue
by default. If it's true it returns the time elapsed in form of human-readable seconds or milliseconds accordingly, else returns in raw nanoseconds.
callback
, simplified
)m.measure(async () => {
// some code to test
}).then(results => console.log(results));
Takes a function callback as input and returns time taken by the code inside to execute.
iterations
, callback
, simplified
)m.measureAvg(5, async () => {
// some code to test
}).then(results => console.log(results));
Takes a function callback as input and runs it repetitively for the number of iterations
provided and returns avgTimeTaken
(Average time taken by the callback to execute) and tests
(Array of time taken by each test).
iterations
, array_of_callbacks
, simplified
)m.batchMeasureAvg(5, [
async () => {
// some code to test
},
async () => {
// some more code to test
}
]).then(results => console.log(results));
Takes an array of function callbacks as input and runs each callback repetitively for the number of iterations
provided and returns an array of results containing avgTimeTaken
(Average time taken by a callback to execute) and tests
(array of time taken by each test).
node-measure
is available under the MIT license. See LICENSE for the full license text.
FAQs
A far better replacement for console.time along with other cool features.
The npm package node-measure receives a total of 0 weekly downloads. As such, node-measure popularity was classified as not popular.
We found that node-measure 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
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.