smarr / ReBench

Execute and document benchmarks reproducibly.
MIT License
84 stars 24 forks source link

Columns don't line up with headers in output. #244

Closed vext01 closed 3 months ago

vext01 commented 3 months ago

When the experiment finishes, a table is printed like this:

-----------------------------------------------------------------------------------------------
  Benchmark    Executor   Suite    Extra   Core      Size   Var   #Samples   Mean (ms)
-----------------------------------------------------------------------------------------------
  Json         Lua        awfy       100   default           30                     30   1150
  Richards     Lua        awfy       100   default           30                     30   4523
  Storage      Lua        awfy      1000   default           30                     30   2163
  Permute      Lua        awfy      1000   default           30                     30   1277
  Queens       Lua        awfy      1000   default           30                     30    856
  DeltaBlue    Lua        awfy     12000   default           30                     30   1196
  Havlak       Lua        awfy      1500   default           30                     30   7009
  Bounce       Lua        awfy      1500   default           30                     30   1412
  List         Lua        awfy      1500   default           30                     30    925
  CD           Lua        awfy       250   default           30                     30   3079
  NBody        Lua        awfy    250000   default           30                     30   1038
  Sieve        Lua        awfy      3000   default           30                     30   1061
  Mandelbrot   Lua        awfy       500   default           30                     30    372
  Towers       Lua        awfy       600   default           30                     30   1367
-----------------------------------------------------------------------------------------------

The output is quite hard to read because the data doesn't line up with the headings.

I don't know if prettytable would help. I've used it a bit for this kind of thing and found that it works pretty (no pun intended) well.

Cheers

smarr commented 3 months ago

Does this do the trick? https://github.com/smarr/ReBench/pull/246

ReBench uses this library for the table formatting: https://humanfriendly.readthedocs.io/en/latest/api.html?highlight=format_pretty_table#humanfriendly.tables.format_pretty_table

vext01 commented 3 months ago

Looks much better!

--------------------------------------------------------------------------------------------------
  Benchmark    Executor   Suite    Extra   Core      Size   Var   Machine   #Samples   Mean (ms)
--------------------------------------------------------------------------------------------------
  Richards     Lua        awfy       100   default                                 1        4362
  Json         Lua        awfy       100   default                                 1        1161
  Queens       Lua        awfy      1000   default                                 1         820
  Storage      Lua        awfy      1000   default                                 1        2117
  Permute      Lua        awfy      1000   default                                 1        1301
  DeltaBlue    Lua        awfy     12000   default                                 1         905
  Bounce       Lua        awfy      1500   default                                 1        1573
  Havlak       Lua        awfy      1500   default                                 1        6731
  List         Lua        awfy      1500   default                                 1        1001
  CD           Lua        awfy       250   default                                 1        3062
  NBody        Lua        awfy    250000   default                                 1         994
  Sieve        Lua        awfy      3000   default                                 1        1246
  Mandelbrot   Lua        awfy       500   default                                 1         371
  Towers       Lua        awfy       600   default                                 1        1247
--------------------------------------------------------------------------------------------------

Cheers :)

smarr commented 3 months ago

Looking at your CI output here: https://ci.soft-dev.org/#/builders/3/builds/307 I am not sure you control the source of you build system, but if you do, you'd want to change the css style from:

.logline>span {
    white-space: nowrap;
}
.logline>span {
    white-space: pre;
}

This should preserver the whitespace. See also: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space#values

vext01 commented 3 months ago

It's buildbot doing that. I'm not too worried, since you can click "raw" and it just gives you plain text with correct formatting.

smarr commented 3 months ago

Closing with #246 being merged. Thanks!

vext01 commented 3 months ago

Cheers Stefan!