vitest icon indicating copy to clipboard operation
vitest copied to clipboard

Benchmark output can be improved

Open guoyunhe opened this issue 1 year ago • 1 comments

Describe the bug

If you write multiple benchmark group in a single file, the output isn't very clear to separate different test cases:

   ✓ setAlpha (2) 7444ms
     name                        hz     min     max    mean     p75     p99    p995    p999     rme  samples
   · @ctrl/tinycolor  18,716,735.25  0.0000  0.0122  0.0001  0.0001  0.0001  0.0001  0.0001  ±0.02%  9358368
   · fastcolor        19,874,881.13  0.0000  0.0291  0.0001  0.0001  0.0001  0.0001  0.0001  ±0.03%  9937441   fastest
   ✓ toHexString (2) 3935ms
     name                        hz     min     max    mean     p75     p99    p995    p999     rme  samples
   · @ctrl/tinycolor   5,342,122.96  0.0002  0.6116  0.0002  0.0002  0.0002  0.0002  0.0005  ±0.90%  2671062
   · fastcolor        10,865,390.93  0.0001  1.1889  0.0001  0.0001  0.0001  0.0001  0.0002  ±0.50%  5432696   fastest
   ✓ toRgbString (2) 7394ms
     name                        hz     min     max    mean     p75     p99    p995    p999     rme   samples
   · @ctrl/tinycolor  17,450,610.85  0.0000  0.0307  0.0001  0.0001  0.0001  0.0001  0.0001  ±0.03%   8725306
   · fastcolor        20,120,086.75  0.0000  0.7499  0.0000  0.0001  0.0001  0.0001  0.0001  ±0.29%  10060044   fastest

If you add some blank lines between cases, it should be more readable:

   ✓ setAlpha (2) 7444ms
     name                        hz     min     max    mean     p75     p99    p995    p999     rme  samples
   · @ctrl/tinycolor  18,716,735.25  0.0000  0.0122  0.0001  0.0001  0.0001  0.0001  0.0001  ±0.02%  9358368
   · fastcolor        19,874,881.13  0.0000  0.0291  0.0001  0.0001  0.0001  0.0001  0.0001  ±0.03%  9937441   fastest

   ✓ toHexString (2) 3935ms
     name                        hz     min     max    mean     p75     p99    p995    p999     rme  samples
   · @ctrl/tinycolor   5,342,122.96  0.0002  0.6116  0.0002  0.0002  0.0002  0.0002  0.0005  ±0.90%  2671062
   · fastcolor        10,865,390.93  0.0001  1.1889  0.0001  0.0001  0.0001  0.0001  0.0002  ±0.50%  5432696   fastest

   ✓ toRgbString (2) 7394ms
     name                        hz     min     max    mean     p75     p99    p995    p999     rme   samples
   · @ctrl/tinycolor  17,450,610.85  0.0000  0.0307  0.0001  0.0001  0.0001  0.0001  0.0001  ±0.03%   8725306
   · fastcolor        20,120,086.75  0.0000  0.7499  0.0000  0.0001  0.0001  0.0001  0.0001  ±0.29%  10060044   fastest

Reproduction

  1. git clone https://github.com/guoyunhe/fastcolor
  2. npm run bench

System Info

System:
    OS: Linux 6.9 openSUSE Tumbleweed 20240613
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 17.50 GB / 31.27 GB
    Container: Yes
    Shell: 5.2.26 - /bin/bash
  Binaries:
    Node: 21.7.3 - /usr/bin/node
    npm: 10.5.0 - /usr/bin/npm
    pnpm: 9.1.3 - ~/.local/share/pnpm/pnpm
  Browsers:
    Chromium: 125.0.6422.141
  npmPackages:
    vitest: ^1.6.0 => 1.6.0

Used Package Manager

pnpm

Validations

guoyunhe avatar Jun 16 '24 06:06 guoyunhe

If you add some blank lines between cases, it should be more readable:

This will be fixed in #7019, here's example:

AriPerkkio avatar Dec 11 '24 14:12 AriPerkkio