Giter Site home page Giter Site logo

Add benchmarks about headtail HOT 6 CLOSED

cleancut avatar cleancut commented on July 26, 2024
Add benchmarks

from headtail.

Comments (6)

CleanCut avatar CleanCut commented on July 26, 2024 1

... which leads to this philosophical question: what is the selling point of headtail?

For me, it is purely the ability to be able to head AND tail in a simultaneous operation.

I'm not opposed to attempting to optimize performance as a secondary goal, but I sincerely doubt many people will ever be searching for a combined head and tail utility because either head or tail is too slow.

Actually, I see performance as more of a tertiary goal, with other useful features being the secondary goal (like following a file while tailing -- which I didn't actually need, but was fun to do).

from headtail.

tbmreza avatar tbmreza commented on July 26, 2024

As a utility whose name begs to be used alongside if not replace head and tail, I think the "benchmark" that's more anticipated in our introduction would be how does it fare against the OG coreutils counterparts.

For example, as a reader I want to know how

headtail somebigfile.txt

compares (after rigorous experiments) against

head somebigfile.txt && tail somebigfile.txt

Or headtail somebigfile.txt -H 25 -T 0 against head somebigfile.txt -n 25?

(Unless I misunderstood "when we make changes we can do a before/after comparison. See criterion.", which to me sounds like using the micro-benchmarking tool to do regression testing.)

from headtail.

CleanCut avatar CleanCut commented on July 26, 2024

Those all sound good to me!

from headtail.

tbmreza avatar tbmreza commented on July 26, 2024

Those all sound good to me!

Awesome. Working on it! 🤓

from headtail.

tbmreza avatar tbmreza commented on July 26, 2024

I found about hyperfine while researching about how such benchmarking could be done. https://github.com/uutils/coreutils/blob/main/src/uu/head/BENCHMARKING.md

There are a couple of options that we could do imo.

====

This is what hyperfine outputs for me:

hyperfine --warmup 3 "head tests/files/input.txt && tail tests/files/input.txt" "target/release/headtail tests/files/input.txt"
Benchmark 1: head tests/files/input.txt && tail tests/files/input.txt
  Time (mean ± σ):       5.4 ms ±   0.8 ms    [User: 2.0 ms, System: 1.8 ms]
  Range (min … max):     4.9 ms …   8.8 ms    263 runs

Benchmark 2: target/release/headtail tests/files/input.txt
  Time (mean ± σ):       7.3 ms ±   0.9 ms    [User: 4.7 ms, System: 1.8 ms]
  Range (min … max):     6.6 ms …  10.9 ms    280 runs

Summary
  'head tests/files/input.txt && tail tests/files/input.txt' ran
    1.34 ± 0.25 times faster than 'target/release/headtail tests/files/input.txt'

... which leads to this philosophical question: what is the selling point of headtail? Is being at least as fast as GNU coreutils counterparts a non-goal? What do you think? @CleanCut

from headtail.

tbmreza avatar tbmreza commented on July 26, 2024

In any case, that meaning of benchmark should be a separate github issue (if regarded valid at all). My next pull-request will be adding criterion for before/after change comparison ✌️.

from headtail.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.