• # Benchmark

    Posté par . En réponse au journal Challenge: Écrire la plus petite implémentation de /bin/true. Évalué à 5.

    Préparatifs:

    /tmp ❯ touch ahah
    /tmp ❯ chmod +x ahah
    

    Et c'est parti

    /tmp ❯ hyperfine "./ahah" "/bin/true"
    Benchmark #1: ./ahah
     Time (mean ± σ): 1.4 ms ± 0.3 ms [User: 0.4 ms, System: 0.1 ms]
     Range (min ... max): 1.0 ms ... 4.8 ms 1409 runs
     Warning: Command took less than 5 ms to complete. Results might be inaccurate.
     Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet PC without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
    Benchmark #2: /bin/true
     Time (mean ± σ): 0.1 ms ± 0.1 ms [User: 0.2 ms, System: 0.0 ms]
     Range (min ... max): 0.0 ms ... 1.2 ms 3048 runs
     Warning: Command took less than 5 ms to complete. Results might be inaccurate.
     Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet PC without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
    Summary
     '/bin/true' ran
     17.52 ± 25.03 times faster than './ahah'
    

    Donc en fait, ça marche plus vite avec un gros fichier. Va savoir pourquoi.