New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vscode/vscode-perf

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vscode/vscode-perf - npm Package Compare versions

Comparing version

to
0.0.5

7

index.d.ts

@@ -38,2 +38,7 @@ /*---------------------------------------------------------------------------------------------

/**
* logs verbose output to the console when errors occur
*/
readonly verbose?: boolean;
/**
* file in which the profile data shall be recorded

@@ -44,2 +49,2 @@ */

export function run(options: Options): Promise<void>;
export function run(options?: Options): Promise<void>;

@@ -23,2 +23,3 @@ "use strict";

.option('--runs <number-of-runs>', 'number of times to run the performance measurement')
.option('-v, --verbose', 'logs verbose output to the console when errors occur')
.addOption(new commander_1.Option('--prof-append-timers <prof-append-timers>').hideHelp(true));

@@ -25,0 +26,0 @@ options = commander_1.program.parse(process.argv).opts();

@@ -78,14 +78,38 @@ "use strict";

const durations = new Map();
let childProcess;
process.on('exit', () => {
if (childProcess) {
childProcess.kill();
}
});
for (let i = 0; i < runs; i++) {
console.log(`${chalk_1.default.gray('[perf]')} running session ${chalk_1.default.green(`${i + 1}`)} of ${chalk_1.default.green(`${runs}`)}...`);
const childProcess = cp.spawn(options.build, codeArgs);
await (new Promise(resolve => childProcess.on('exit', () => resolve())));
const lines = fs.readFileSync(perfFile, 'utf8').split('\n');
let content = '';
for (let j = lines.length - 1; j >= 0 && !content; j--) {
content = lines[j];
childProcess = cp.spawn(options.build, codeArgs);
childProcess.stdout.on('data', data => {
if (options.verbose) {
console.log(`${chalk_1.default.gray('[electron]')}: ${data.toString()}`);
}
});
childProcess.stderr.on('data', data => {
if (options.verbose) {
console.log(`${chalk_1.default.red('[electron]')}: ${data.toString()}`);
}
});
await (new Promise(resolve => childProcess?.on('exit', () => resolve())));
childProcess = undefined;
if (fs.existsSync(perfFile)) {
const content = readLastLineSync(perfFile);
for (const marker of markers) {
logMarker(content, marker, durations);
}
}
for (const marker of markers) {
logMarker(content, marker, durations);
else if (options.profAppendTimers) {
const content = readLastLineSync(options.profAppendTimers);
const marker = 'ellapsed';
logMarker(`${marker} ${content}`, marker, durations);
}
else {
console.error('No perf file found');
process.exit(1);
}
}

@@ -112,2 +136,11 @@ console.log(`${chalk_1.default.gray('[perf]')} ${chalk_1.default.blueBright('Summary')}:`);

}
function readLastLineSync(path) {
const contents = fs.readFileSync(path, 'utf8');
const lines = contents.split(/\r?\n/);
let lastLine;
while (!lastLine && lines.length > 0) {
lastLine = lines.pop();
}
return lastLine ?? '';
}
function escapeRegExpCharacters(value) {

@@ -114,0 +147,0 @@ return value.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g, '\\$&');

2

package.json
{
"name": "@vscode/vscode-perf",
"version": "0.0.4",
"version": "0.0.5",
"description": "Tooling for evaluating performance of VS Code",

@@ -5,0 +5,0 @@ "repository": {