Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function (url, opts) {
performance.mark(url + " - begin")
const { fetch } = abortableFetch(nodeFetch) as any
return fetch(url, opts).then(_ => {
performance.mark(url + " - end")
const measure = () => performance.measure(_.url, url + " - begin", url + " - end")
performance.clearMarks(url + " - begin")
if(timeout)
setTimeout(measure, timeout)
else
measure()
return _
})
}
setTimeout(() => {
performance.mark('B');
performance.measure('A to B', 'A', 'B');
}, 1);
setTimeout(() => {
performance.mark('B');
performance.measure('A to B', 'A', 'B');
}, 1);
const perf = name => {
if (measures.includes(name)) {
performance.mark(`${name}_end`);
performance.measure(`${name} start to ${name} end`, name, `${name}_end`);
//let measure = performance.getEntriesByName(`${name} start to ${name} end`)[0];
//log(`${name} Done in ${(measure.duration/1000).toFixed(2)}s.`);
clearPerf(name);
}
else {
performance.mark(name);
const obs = new PerformanceObserver((list, observer) => {
console.log(list.getEntries());
observer.disconnect();
});
measures.push(name);
}
};
function(){
performance.mark(self._ongoingMark);
performance.measure(self._downloadOngoing, self._startMark, self._ongoingMark);
}, this._interval);
}
fastify.addHook('preHandler', function (request, reply, next) {
const id = request.raw.id
performance.mark(PREHANDLER + id)
next()
})
deepEqual(fn(fixtureString), [1]);
deepEqual(fn(fixtureBufferWithBom), [3]);
deepEqual(fn(fixtureStringWithBom, 'utf8'), [3]);
performance.mark('start');
for (const [fixtureName, fixture] of new Map([
['buffer ', fixtureBuffer],
['string ', fixtureString],
['buffer with BOM ', fixtureBufferWithBom],
['string with BOM ', fixtureStringWithBom]
])) {
const marks = [`${fixtureName} start`, `${fixtureName} end`];
let i = 1500000;
performance.mark(marks[0]);
while (i--) {
fn(fixture);
}
performance.mark(marks[1]);
performance.measure(fixtureName, ...marks);
}
performance.mark('end');
performance.measure('sum', 'start', 'end');
})();
function parse(input, debug) {
performance.mark('A');
var stream = tokenizer.tokenize(tokensDefinition, input);
performance.mark('B');
var tree = parser.parse(grammar, stream, debug);
performance.mark('C');
if(!tree.success) {
utils.displayError(input, stream, tokensDefinition, grammar, tree)
}
return tree
}
function parse(input, debug) {
performance.mark('A');
var stream = tokenizer.tokenize(tokensDefinition, input);
performance.mark('B');
var tree = parser.parse(grammar, stream, debug);
performance.mark('C');
if(!tree.success) {
utils.displayError(input, stream, tokensDefinition, grammar, tree)
}
return tree
}
function parse(input, debug) {
performance.mark('A');
var stream = tokenizer.tokenize(tokensDefinition, input);
performance.mark('B');
var tree = parser.parse(grammar, stream, debug);
performance.mark('C');
if(!tree.success) {
utils.displayError(input, stream, tokensDefinition, grammar, tree)
}
return tree
}