Skip to content

scripts: add logging toggle to naiv-benchmark hot loops #76

@nerdalytics

Description

@nerdalytics

Finding

scripts/naiv-benchmark.ts has console.debug calls inside the tight benchmark loops (lines 8-11, 76-84, 105-110). The commented results at the bottom of the file show "with fair logging" vs "without any logging" comparisons, indicating the logging impact was recognized.

The script always runs with logging enabled. It measures I/O overhead as much as signal performance.

Impact

Benchmark results are misleading. The console.debug calls dominate the timing in the hot paths, masking the actual cost of reactive operations.

Proposed fix

Add an environment variable or CLI flag to toggle logging. Something like LOG=1 npx tsx scripts/naiv-benchmark.ts for the logging variant, silent by default. This lets the script produce clean numbers for signal performance while preserving the logging variant for comparison.

Source: out/report-simplify.txt, Finding 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions