Skip to content

cat: Poor performance with any formatting #7518

@karlmcdowall

Description

@karlmcdowall

Performance of (for example) cat -n is pretty bad...

$ hyperfine "./target/release/cat -n ./shakespeare.txt" "/usr/bin/cat -n ./shakespeare.txt"
Benchmark 1: ./target/release/cat -n ./shakespeare.txt
  Time (mean ± σ):     236.8 ms ±   3.1 ms    [User: 141.5 ms, System: 95.1 ms]
  Range (min … max):   231.5 ms … 243.8 ms    12 runs
 
Benchmark 2: /usr/bin/cat -n ./shakespeare.txt
  Time (mean ± σ):      11.3 ms ±   0.6 ms    [User: 9.8 ms, System: 1.5 ms]
  Range (min … max):    10.4 ms …  15.3 ms    232 runs
 
Summary
  /usr/bin/cat -n ./shakespeare.txt ran
   20.98 ± 1.20 times faster than ./target/release/cat -n ./shakespeare.txt

Fix incoming...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions