Skip to content

Instantly share code, notes, and snippets.

View victor-homyakov's full-sized avatar

Victor Homyakov victor-homyakov

View GitHub Profile
@victor-homyakov
victor-homyakov / links - dead code elimination.md
Last active April 7, 2025 15:24
Ссылки для презентации "Удаление мертвого кода в проекте: практическое руководство" HolyJS 2025
@victor-homyakov
victor-homyakov / links - node and linux perf.md
Last active February 19, 2025 12:46
Ссылки для презентации "Ускорение приложений на Node: когда стандартного профайлера недостаточно" HolyJS 2024
function createPackedSmiArray(n) {
const arr = [];
for (let i = 0; i < n; i++) {
arr.push(i);
}
return arr;
}
function createHoleySmiArray(n) {
return Array.from({ length: n }, (_, i) => i);
@victor-homyakov
victor-homyakov / links - bun vs node.md
Last active April 17, 2024 15:44
Ссылки для презентации "Bun vs Node" HolyJS 2024
@victor-homyakov
victor-homyakov / sort-perf-map.js
Created January 8, 2024 12:53
Sort perf-PID.map file generated by Node.js
const fs = require('node:fs');
const readline = require('node:readline');
const fileName = process.argv[2];
if (!fileName) {
console.error('Please specify map file name as the first argument');
process.exit(1);
}
function extractAddress(/*string*/line) {
@victor-homyakov
victor-homyakov / index.js
Created December 21, 2023 21:30
Benchmark startup time
// Use dependencies from https://gist.github.com/victor-homyakov/b41cd9dbea99eec870464cf49bb019a7
require("@nestjs/axios");
require("@nestjs/common");
require("@nestjs/config");
require("@nestjs/core");
require("@nestjs/platform-express");
require("@nestjs/swagger");
require("@nestjs/terminus");
require("@nestjs/throttler");
require("@sentry/node");
@victor-homyakov
victor-homyakov / package.json
Created December 16, 2023 13:22
package.json to benchmark installation of dependencies
{
"name": "install-benchmark",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Victor Homyakov",
@victor-homyakov
victor-homyakov / buffers.js
Last active April 7, 2024 14:09
Log parsing benchmark
// To avoid slowdown from GC, run node with the following keys:
// --expose-gc --initial-old-space-size=1024
const fs = require('fs');
//const heapdump = require('heapdump');
const buffers = fs.readFileSync('buffers.txt').toString().split('\n');
const parse0 = line => {
return {};
@victor-homyakov
victor-homyakov / benchmark-utils.js
Created October 28, 2023 17:49
Benchmark: show minimum, median, maximum values
/*
* Wrapper for https://www.npmjs.com/package/benchmark
* Calculates minimum, median, maximum values of the sample
*/
const Benchmark = require('benchmark');
const units = ['s/op', 'ms/op', 'μs/op', 'ns/op'];
/**
@victor-homyakov
victor-homyakov / links - benchmarks and performance tests 2023.md
Last active October 29, 2024 20:39
Ссылки для презентации "Бенчмарки и performance-тесты для JavaScript/TypeScript" HolyJS 2023