{"id":18803515,"url":"https://github.com/rofrol/rust-regex-stdin-by-line-benchmark","last_synced_at":"2026-01-05T16:30:15.622Z","repository":{"id":66526221,"uuid":"211694927","full_name":"rofrol/rust-regex-stdin-by-line-benchmark","owner":"rofrol","description":null,"archived":false,"fork":false,"pushed_at":"2019-09-29T18:46:33.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-19T07:37:05.799Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rofrol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-29T16:50:51.000Z","updated_at":"2022-03-13T19:04:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"f0724dad-0178-4968-a656-8b8e0349413c","html_url":"https://github.com/rofrol/rust-regex-stdin-by-line-benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofrol%2Frust-regex-stdin-by-line-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofrol%2Frust-regex-stdin-by-line-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofrol%2Frust-regex-stdin-by-line-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofrol%2Frust-regex-stdin-by-line-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rofrol","download_url":"https://codeload.github.com/rofrol/rust-regex-stdin-by-line-benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239735263,"owners_count":19688262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T22:35:37.981Z","updated_at":"2026-01-05T16:30:15.556Z","avatar_url":"https://github.com/rofrol.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Based on discussion from https://www.reddit.com/r/rust/comments/d9zfa6/how_come_php_seems_so_much_faster_than_rust/\n\n\n## Run\n\n```bash\n$ cargo install hyperfine\n$ ./genearate_log.sh\n$ cargo build --release --bins\n$ hyperfine 'target/release/original \u003c test.log'\n$ hyperfine 'target/release/output_buffered \u003c test.log'\n$ hyperfine 'target/release/output_and_input_buffered \u003c test.log'\n$ hyperfine 'target/release/parser \u003c test.log'\n```\n\n## Results\n\n``` bash\n$ hyperfine --warmup 10 'target/release/original \u003c test.log'\nBenchmark #1: target/release/original \u003c test.log\n  Time (mean ± σ):     151.0 ms ±   1.3 ms    [User: 53.2 ms, System: 89.6 ms]\n  Range (min … max):   148.9 ms … 153.8 ms    19 runs\n\n$ hyperfine --warmup 10 'target/release/output_buffered \u003c test.log'\nBenchmark #1: target/release/output_buffered \u003c test.log\n  Time (mean ± σ):      39.4 ms ±   0.7 ms    [User: 32.2 ms, System: 4.1 ms]\n  Range (min … max):    38.4 ms …  42.4 ms    68 runs\n\n$ hyperfine --warmup 10 'target/release/output_buffered2 \u003c test.log'\nBenchmark #1: target/release/output_buffered2 \u003c test.log\n  Time (mean ± σ):      84.4 ms ±   2.6 ms    [User: 73.5 ms, System: 8.3 ms]\n  Range (min … max):    81.6 ms …  94.9 ms    34 runs\n\n$ hyperfine --warmup 10 'target/release/output_and_input_buffered \u003c test.log'\nBenchmark #1: target/release/output_and_input_buffered \u003c test.log\n  Time (mean ± σ):      40.4 ms ±   0.9 ms    [User: 34.9 ms, System: 3.8 ms]\n  Range (min … max):    39.0 ms …  43.5 ms    64 runs\n\n$ hyperfine --warmup 10 'target/release/parser \u003c test.log'\nBenchmark #1: target/release/parser \u003c test.log\n  Time (mean ± σ):     246.1 ms ±   1.6 ms    [User: 68.6 ms, System: 174.6 ms]\n  Range (min … max):   244.2 ms … 250.0 ms    12 runs\n```\n\n## Links\n\n- https://www.reddit.com/r/rust/comments/9xedap/how_to_achieve_fast_stdinstdout_io_suitable_for/e9t4vle/\n- output buffered example https://www.reddit.com/r/rust/comments/8833lh/performance_of_parsing_large_file_2gb/dwj6ozo/\n- https://stackoverflow.com/questions/31289588/converting-a-str-to-a-u8\n- for `write_fmt` use `write!` https://stackoverflow.com/questions/32472495/how-do-i-write-a-formatted-string-to-a-file/32472705#32472705\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofrol%2Frust-regex-stdin-by-line-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frofrol%2Frust-regex-stdin-by-line-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofrol%2Frust-regex-stdin-by-line-benchmark/lists"}