René's URL Explorer Experiment


Title: Optimize file I/O tools in llm-coding-tools-core · Issue #96 · Reloaded-Project/ReloadedCode · GitHub

Open Graph Title: Optimize file I/O tools in llm-coding-tools-core · Issue #96 · Reloaded-Project/ReloadedCode

X Title: Optimize file I/O tools in llm-coding-tools-core · Issue #96 · Reloaded-Project/ReloadedCode

Description: Summary Benchmark all 5 core file I/O tools (read, edit, write, glob, grep) with criterion using real Rust source files as test data Optimize read_file hot path: 35-75% faster across all file sizes Optimize GrepOutput::format(): 69-76% f...

Open Graph Description: Summary Benchmark all 5 core file I/O tools (read, edit, write, glob, grep) with criterion using real Rust source files as test data Optimize read_file hot path: 35-75% faster across all file sizes...

X Description: Summary Benchmark all 5 core file I/O tools (read, edit, write, glob, grep) with criterion using real Rust source files as test data Optimize read_file hot path: 35-75% faster across all file sizes...

Opengraph URL: https://github.com/Reloaded-Project/ReloadedCode/issues/96

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Optimize file I/O tools in llm-coding-tools-core","articleBody":"## Summary\n\n- Benchmark all 5 core file I/O tools (read, edit, write, glob, grep) with criterion using **real Rust source files** as test data\n- Optimize `read_file` hot path: 35-75% faster across all file sizes\n- Optimize `GrepOutput::format()`: 69-76% faster for both line-number modes\n- Fix arithmetic overflow in `read_file` capacity estimation\n- Edit, write, glob, and grep search are I/O-bound; algorithmic improvements yield 0-4%\n\n## Commits\n\nSplit into two commits:\n\n1. **Add criterion benchmarks** - benchmark suites + corpus data only\n2. **Optimize file I/O tools** - source code optimizations\n\n## Realistic benchmark corpus\n\nBenchmark test data is sourced from real Rust files (Apache-2.0, [codex-rs](https://github.com/openai/codex)) selected to match aggregate statistics measured across ~3,300 `.rs` files:\n\n| Metric | Corpus | Measured Average |\n|--------|--------|-----------------|\n| Non-blank avg line length | 37.7 chars | 37.7 chars |\n| Blank line ratio | ~10.5% | ~10.5% |\n| Avg bytes/line | 34.7 | 34.7 |\n\n| Size | Source | Lines |\n|------|--------|-------|\n| Small | `core/src/tools/handlers/plan.rs` | 122 |\n| Medium | `mcp-server/src/outgoing_message.rs` | 356 |\n| Large | `core/src/unified_exec/session_manager.rs` | 770 |\n\nShared via `benches/common/mod.rs` with `#[path]` attribute (no Cargo.toml changes needed).\n\n## Key changes\n\n**read.rs** - The big win. Replaced `write!` format macro with manual `push_usize` integer formatting, added ASCII fast path with `from_utf8_unchecked`, made `process_line` const-generic over line_numbers, added bulk `memchr_iter` newline skip for offset reads, and used `from_utf8` direct check instead of `from_utf8_lossy` Cow wrapper. Fixed overflow in capacity math with saturating arithmetic.\n\n**grep.rs** - Applied same `write!` -\u003e `push_str` + `push_u64` transformation to `format()`, added `sort_unstable_by`, `to_str()` fast path for paths, and pre-allocated matches Vec.\n\n**edit.rs** - Combined `replace_all` into single-pass `match_indices` loop. I/O-bound at ~15-67 µs; further gains blocked by syscall overhead.\n\n**write.rs / glob.rs** - Minimal gains; dominated by filesystem I/O. Glob adds partial sort via `select_nth_unstable_by` and deferred String conversion. OverrideBuilder approach was tested and reverted due to nested `.gitignore` correctness bug.\n\n## Significant improvements\n\n| Tool | Case | Before | After | Change |\n|------|------|--------|-------|--------|\n| read | small (122 lines, with LN) | 2.2 µs | 1.42 µs | -35% |\n| read | medium (356 lines, with LN) | 14.1 µs | 6.6 µs | -53% |\n| read | large (770 lines, with LN) | 53.2 µs | 24.9 µs | -53% |\n| read | offset_read (with LN) | 2.5 µs | 1.68 µs | -33% |\n| read | crlf (356 lines, with LN) | 13.9 µs | 6.58 µs | -53% |\n| read | small (122 lines, no LN) | - | 1.25 µs | new |\n| read | medium (356 lines, no LN) | - | 4.7 µs | new |\n| read | large (770 lines, no LN) | - | 16.7 µs | new |\n| read | offset_read (no LN) | - | 1.48 µs | new |\n| read | crlf (356 lines, no LN) | - | 4.7 µs | new |\n| grep format | with line numbers (~300 matches) | 5.60 µs | 1.49 µs | -73% |\n| grep format | without line numbers (~300 matches) | 2.67 µs | 0.83 µs | -69% |\n\n## No significant improvements (I/O-bound)\n\n| Tool | Case | Before | After | Change | Bottleneck |\n|------|------|--------|-------|--------|------------|\n| edit | rename_string (122 lines) | 19.6 µs | 19.2 µs | -2% | 6 syscalls |\n| edit | replace_all (770 lines) | 66.6 µs | 65.4 µs | -2% | 6 syscalls |\n| edit | not_found (356 lines) | 13.0 µs | 13.0 µs | ~0% | 6 syscalls |\n| edit | update_constant (770 lines) | 14.9 µs | 14.6 µs | -2% | 6 syscalls |\n| write | small (~4 KB) | 17 µs | 17 µs | ~0% | mkdir + write |\n| write | medium (~12 KB) | 26 µs | 26 µs | ~0% | write syscall |\n| write | nested_dirs (a/b/c) | 42 µs | 41 µs | ~0% | mkdir -p |\n| glob | small_tree (~10 files) | 104 µs | 102 µs | ~0% | walk + stat |\n| glob | large_tree (~300 files) | 944 µs | 950 µs | ~0% | walk + stat |\n| glob | no_matches (~300 files) | 578 µs | 555 µs | -4% | walk + stat |\n| glob | deep_nesting (10 levels) | 146 µs | 141 µs | -3% | walk + stat |\n| grep search | single_file | 58 µs | 58 µs | ~0% | regex + I/O |\n| grep search | multi_file (10 files) | 79 µs | 76 µs | -4% | regex + I/O |\n| grep search | no_matches | 74 µs | 71 µs | -4% | regex + I/O |\n| grep search | regex_pattern (fn\\s+\\w+) | 2.4 ms | 2.4 ms | ~0% | regex engine |\n| grep search | large_tree (30 files) | 241 µs | 236 µs | -2% | regex + I/O |\n\nedit, write, glob, and grep search are dominated by kernel VFS syscall overhead and external crate costs (grep-regex, ignore walker). The algorithmic improvements are real but invisible under I/O noise.\n\n## Bugs fixed\n\n| Tool | Bug | Status |\n|------|-----|--------|\n| read | Arithmetic overflow in capacity estimation (`limit * 64` could panic/wrap) | Fixed: saturating arithmetic + 1 MiB cap |\n| glob | OverrideBuilder bypassed nested `.gitignore` rules | Reverted; kept partial-sort optimizations |\n\n## Benchmark suite overview\n\n### tools_read.rs - 5 cases × 2 modes (with/without line numbers)\n| Case | Corpus | What it tests |\n|------|--------|---------------|\n| small_file | Small (122 lines) | Small file, fits in one read |\n| medium_file | Medium (356 lines) | Medium file, buffered reads |\n| large_file | Large (770 lines) | Large file, many lines processed |\n| offset_read | Medium + offset 50 + limit 50 | Partial read with offset |\n| crlf_file | Medium with CRLF endings | CRLF stripping overhead |\n\n### tools_edit.rs - 5 cases\n| Case | Corpus | What it tests |\n|------|--------|---------------|\n| rename_string | Small | Rename `update_plan` → `update_task_plan` |\n| change_type | Medium | Change type `mpsc::UnboundedSender` → `mpsc::Sender` |\n| update_constant | Large | Update `Duration::from_millis(100)` → `200` |\n| replace_all | Large | Bulk rename `process_id` → `session_id` |\n| not_found | Medium | Error path: string not found |\n\n### tools_write.rs - 4 cases\n| Case | Content | What it tests |\n|------|---------|---------------|\n| small_write | Corpus Small (~4 KB) | Write small source file |\n| medium_write | Corpus Medium (~12 KB) | Write medium source file |\n| large_write | Corpus Large (~26 KB) | Write large source file |\n| nested_dirs | Corpus Small + a/b/c/ path | Create nested directories |\n\n### tools_grep.rs - 5 cases × 2 modes + 2 format benchmarks\n| Case | Files | Pattern | What it tests |\n|------|-------|---------|---------------|\n| single_file | 1 | `fn ` | Single file, function definitions |\n| multi_file | 10 | `fn ` | Multi-file search |\n| no_matches | 10 | `xyznonexistent` | Fast rejection |\n| regex_pattern | 10 | `fn\\s+\\w+` | Complex regex matching |\n| large_tree | 30 | `fn ` | Large directory tree traversal |\n\n### tools_glob.rs - 4 cases\n| Case | Files | Pattern | What it tests |\n|------|-------|---------|---------------|\n| small_tree | ~10 | `**/*.rs` | Small project |\n| large_tree | ~300 | `**/*.rs` | Large monorepo |\n| no_matches | ~300 | `*.xyz` | Full traversal, no matches |\n| deep_nesting | ~10 | `**/*.rs` | Deep directory nesting |\n\n## Test plan\n\n- [x] All 357 existing tests pass across all feature flags (tokio, blocking, linux-bubblewrap)\n- [x] `.cargo/verify.sh` passes (build, test, clippy, docs, fmt)\n- [x] Edge-case tests for all bug fixes\n- [x] 5 new benchmark suites compile and produce valid throughput measurements","author":{"url":"https://github.com/Sewer56","@type":"Person","name":"Sewer56"},"datePublished":"2026-04-08T14:23:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/96/ReloadedCode/issues/96"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6e87d298-bbda-588c-e271-86c3e889df27
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8CA2:1FC446:A832E9:EB77EE:6A624DA6
html-safe-nonce3be90b87650926ce004de28ddfaaafb87f7339f3fb1140241cb07051e2c645d7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Q0EyOjFGQzQ0NjpBODMyRTk6RUI3N0VFOjZBNjI0REE2IiwidmlzaXRvcl9pZCI6Ijg5MzI1MzEzMDE2MjQ0NjY4NTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac002dccb8799e3b7bfcd7e32cc194a21f6cea553d9f6132e09218bb761b69df26
hovercard-subject-tagissue:4225263517
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Reloaded-Project/ReloadedCode/96/issue_layout
twitter:imagehttps://opengraph.githubassets.com/efc1b8e1e09322a275c1a78663ab48adff58f119f5c19ebd5e119dfec1998d33/Reloaded-Project/ReloadedCode/issues/96
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/efc1b8e1e09322a275c1a78663ab48adff58f119f5c19ebd5e119dfec1998d33/Reloaded-Project/ReloadedCode/issues/96
og:image:altSummary Benchmark all 5 core file I/O tools (read, edit, write, glob, grep) with criterion using real Rust source files as test data Optimize read_file hot path: 35-75% faster across all file sizes...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSewer56
hostnamegithub.com
expected-hostnamegithub.com
None77f5af7d0fa3843b1779a53f60ec016b3f962e46051fb05c2e9b608a8138eefb
turbo-cache-controlno-preview
go-importgithub.com/Reloaded-Project/ReloadedCode git https://github.com/Reloaded-Project/ReloadedCode.git
octolytics-dimension-user_id45473408
octolytics-dimension-user_loginReloaded-Project
octolytics-dimension-repository_id1128130629
octolytics-dimension-repository_nwoReloaded-Project/ReloadedCode
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1128130629
octolytics-dimension-repository_network_root_nwoReloaded-Project/ReloadedCode
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released3ce7d369aae307e197872f810f80f3ed9051c78
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/Reloaded-Project/ReloadedCode/issues/96#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FReloaded-Project%2FReloadedCode%2Fissues%2F96
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FReloaded-Project%2FReloadedCode%2Fissues%2F96
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=Reloaded-Project%2FReloadedCode
Reloadhttps://github.com/Reloaded-Project/ReloadedCode/issues/96
Reloadhttps://github.com/Reloaded-Project/ReloadedCode/issues/96
Reloadhttps://github.com/Reloaded-Project/ReloadedCode/issues/96
Please reload this pagehttps://github.com/Reloaded-Project/ReloadedCode/issues/96
Reloaded-Project https://github.com/Reloaded-Project
ReloadedCodehttps://github.com/Reloaded-Project/ReloadedCode
Notifications https://github.com/login?return_to=%2FReloaded-Project%2FReloadedCode
Fork 4 https://github.com/login?return_to=%2FReloaded-Project%2FReloadedCode
Star 9 https://github.com/login?return_to=%2FReloaded-Project%2FReloadedCode
Code https://github.com/Reloaded-Project/ReloadedCode
Issues 0 https://github.com/Reloaded-Project/ReloadedCode/issues
Pull requests 1 https://github.com/Reloaded-Project/ReloadedCode/pulls
Actions https://github.com/Reloaded-Project/ReloadedCode/actions
Projects https://github.com/Reloaded-Project/ReloadedCode/projects
Security and quality 0 https://github.com/Reloaded-Project/ReloadedCode/security
Insights https://github.com/Reloaded-Project/ReloadedCode/pulse
Code https://github.com/Reloaded-Project/ReloadedCode
Issues https://github.com/Reloaded-Project/ReloadedCode/issues
Pull requests https://github.com/Reloaded-Project/ReloadedCode/pulls
Actions https://github.com/Reloaded-Project/ReloadedCode/actions
Projects https://github.com/Reloaded-Project/ReloadedCode/projects
Security and quality https://github.com/Reloaded-Project/ReloadedCode/security
Insights https://github.com/Reloaded-Project/ReloadedCode/pulse
#97https://github.com/Reloaded-Project/ReloadedCode/pull/97
Optimize file I/O tools in llm-coding-tools-corehttps://github.com/Reloaded-Project/ReloadedCode/issues/96#top
#97https://github.com/Reloaded-Project/ReloadedCode/pull/97
https://github.com/Sewer56
Sewer56https://github.com/Sewer56
on Apr 8, 2026https://github.com/Reloaded-Project/ReloadedCode/issues/96#issue-4225263517
codex-rshttps://github.com/openai/codex
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.