Skip to content

Conversation

@cramforce
Copy link
Contributor

Summary

This PR introduces significant performance optimizations for filesystem operations and adds new features for file processing commands. Key improvements include parallel batch processing, shared utilities for multi-file operations, and new command options.

Changes

Performance Optimizations

  • Parallel batch processing: Added Promise.all with configurable batch sizes (default: 100) across multiple commands:

    • find - Parallel directory traversal with readdirWithFileTypes optimization
    • du - Parallel size calculation with batched stat calls
    • ls -R - Parallel recursive listing
    • tree - Parallel tree building
    • grep - Parallel file searching
    • glob - Parallel glob expansion
  • readdirWithFileTypes API: Added new filesystem interface method to get directory entries with type info, avoiding separate stat calls for type checks. Implemented in OverlayFS.

  • Smart stat skipping: find now skips stat calls when only type info is needed (e.g., -type f) and full metadata isn't required.

New Features

xargs -d delimiter option

  • Added -d DELIM option for custom input delimiter (GNU xargs extension)
  • Supports escape sequences: \n, \t, \r, \0, \\
  • Enables efficient patterns like: find . -name '*.json' | xargs -d '\n' jq .

jq multi-file support

  • jq now correctly processes multiple input files in parallel
  • Fixed NDJSON handling: falls back to line-by-line parsing when single JSON parse fails
  • Works with glob patterns and find | xargs pipelines

Shared batched-read utility

  • New src/commands/batched-read.ts module for parallel file reading
  • Used by jq and xan cat for efficient multi-file processing
  • Configurable batch size with error handling

dev:exec improvements

  • Added --root <path> for OverlayFS mounting
  • Added --no-limit to remove execution limits for large scripts
  • Increased default limits to 100,000 for dev:exec

Bug Fixes

  • Fixed jq only reading first file when multiple files passed
  • Fixed xargs not preserving spaces in items when using custom delimiter
  • Fixed trailing newline handling in xargs delimiter mode

Test Plan

  • All 5913 unit tests pass
  • Added 10 new tests for xargs -d option
  • Added 12 new tests for jq multi-file support
  • Typecheck passes
  • Lint passes (biome)
  • Knip passes (no unused exports)

Performance Results

Tested against a large filesystem (68k+ repos, 110k+ JSON files):

  • find repos -type d -name 'issues': 1.6s for 7,581 results
  • repos/**/*.json glob: 1.7s for 109,915 files
  • jq with 28k files: 4.6s (down from 9.2s with batching)

…em operations and adds new features for file processing commands. Key improvements include parallel batch processing, shared utilities for multi-file operations, and new command options.
@vercel
Copy link

vercel bot commented Jan 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
just-bash Ignored Ignored Jan 12, 2026 0:48am

}

return { results };
}
Copy link

@vercel vercel bot Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File has an extra trailing newline after the closing brace, causing a linting error

Fix on Vercel

@cramforce cramforce merged commit f7d359b into main Jan 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants