This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // benchmark-optimized.ts | |
| import { performance } from 'node:perf_hooks'; | |
| interface Thread { | |
| firstNodeId: number; | |
| lastNodeId: number; | |
| nextNodes: number[]; | |
| } | |
| type NodeId = number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os from 'os'; | |
| import {performance} from 'perf_hooks'; | |
| type NotFalsey<T> = Exclude<T, false | null | 0 | 0n | '' | undefined>; | |
| /** | |
| * Удаляет все falsy значения из массива. | |
| * Использует стандартный цикл for с доступом к arr.length на каждой итерации. | |
| * | |
| * @template T - тип элементов входного массива |