https://github.com/djc/topfew-rs
Rust implementation of Tim Bray's topfew tool
https://github.com/djc/topfew-rs
Last synced: 3 months ago
JSON representation
Rust implementation of Tim Bray's topfew tool
- Host: GitHub
- URL: https://github.com/djc/topfew-rs
- Owner: djc
- License: gpl-3.0
- Created: 2020-05-19T12:01:46.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-03T10:52:27.000Z (4 months ago)
- Last Synced: 2025-04-10T04:07:42.857Z (3 months ago)
- Language: Rust
- Homepage:
- Size: 151 KB
- Stars: 40
- Watchers: 2
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# topfew-rs: Rust implementation of Tim Bray's topfew tool
Tim Bray [blogged about topfew](https://www.tbray.org/ongoing/When/202x/2020/05/18/TopFew),
his Go [implementation](https://github.com/timbray/topfew/) of a tool to replace the
`awk '{print $1}' access_log | sort | uniq -c | sort -rn | head -12` pipeline.
This is a reimplementation of that tool in idiomatic stable Rust.The initial Rust version was 2.9x faster than Tim's Go implementation;
current main appears to be around 6.7x faster thanks to some additional optimizations.
The Rust version currently has slightly fewer non-test SLOC than the Go version.
Thanks to [Thomas Andreas Jung](https://github.com/blob79) for contributing substantial
performance improvements.```
Usage: tf [OPTIONS] --fieldsArguments:
File to searchOptions:
-f, --fields Fields to use as part of the line's key
-n, --num Top number of matches to show [default: 10]
-e, --regex Regular expression used to split lines into fields [default: "[ \\t]"]
-h, --help Print help
```If you have the Rust toolchain installed, you can install it with `cargo install topfew`.