Last active
February 3, 2018 10:17
-
-
Save 17g/0741527eb6ba7df226ec5a2009c8c21b to your computer and use it in GitHub Desktop.
Rust で tail コマンドを実装してみた ref: https://qiita.com/17g/items/e4bc81e5c2c8428858a7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cargo -V | |
cargo 0.24.0 (45043115c 2017-12-05) | |
$ rustc -V | |
rustc 1.23.0 (766bd11c8 2018-01-01) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: rtail [options] FILE | |
Options: | |
-n NUMS number of lines | |
-h print help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time tail -n 10000 120000.log | |
tail -n 10000 120000.log 0.06s user 0.02s system 30% cpu 0.251 total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time ./target/debug/rtail -n 10000 120000.log | |
./target/debug/rtail -n 10000 120000.log 0.63s user 1.15s system 90% cpu 1.979 total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time ./target/release/rtail -n 10000 120000.log | |
./target/release/rtail -n 10000 120000.log 0.26s user 1.14s system 87% cpu 1.591 total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time ./target/debug/rtail -n 10000 120000.log | |
./target/debug/rtail -n 10000 120000.log 0.09s user 0.01s system 70% cpu 0.132 total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time ./target/release/rtail -n 10000 120000.log | |
./target/release/rtail -n 10000 120000.log 0.00s user 0.01s system 7% cpu 0.205 total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment