Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf_tests: Right-align numeric metrics in markdown tables #2619

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

tchaikov
Copy link
Contributor

Right-align metrics columns in markdown output for better number comparison. Previously, metrics were left-aligned in markdown tables but right-aligned in stdout, making it difficult to visually compare numbers.

The change adds colons to the right of hyphens in the header row (e.g. |---:|) to right-align entire columns. While this affects both headers and data cells, the improved readability of numeric values outweighs the minor tradeoff of right-aligned headers.

In short:

  • Uses column::print_text with ":>" alignment for consistent formatting
  • Maintains existing stdout_printer right alignment
  • Updates markdown_printer alignment to match stdout behavior

@tchaikov
Copy link
Contributor Author

tchaikov commented Jan 16, 2025

i am using the test result of #2599 on my machine as an example:

without this change

test iterations median mad min max allocs tasks inst cycles
parallel_for_each.empty 935586996 1.092ns 0.013ns 1.074ns 1.190ns 0.000 0.000 14.0 0.0
chain.then_value 37359328 26.092ns 0.143ns 25.949ns 26.687ns 1.063 1.094 314.6 0.0
chain.await_value 32709344 30.681ns 0.361ns 30.321ns 31.610ns 1.094 1.125 413.8 0.0
chain.then_exception 36791808 27.328ns 0.095ns 27.135ns 27.813ns 1.094 1.094 316.0 0.0
chain.await_exception 673984 1.514us 17.089ns 1.489us 1.531us 2.156 1.125 23362.3 0.0
parallel_for_each.immediate_1 563986150 1.766ns 0.002ns 1.763ns 1.776ns 0.000 0.000 33.0 0.0
parallel_for_each.immediate_2 557183460 1.772ns 0.020ns 1.751ns 1.799ns 0.000 0.000 31.0 0.0
parallel_for_each.immediate_10 557035880 1.769ns 0.003ns 1.766ns 1.805ns 0.000 0.000 19.8 0.0
parallel_for_each.immediate_100 606451230 1.647ns 0.003ns 1.640ns 1.668ns 0.000 0.000 17.4 0.0
parallel_for_each.suspend_1 12702292 79.106ns 0.786ns 78.320ns 81.039ns 5.000 5.000 1232.5 0.0
parallel_for_each.suspend_2 19163698 51.725ns 0.460ns 50.854ns 52.724ns 3.000 3.000 766.8 0.0
parallel_for_each.suspend_10 27335180 31.127ns 0.721ns 29.513ns 32.540ns 1.400 1.400 377.5 0.0
parallel_for_each.suspend_100 55704132 18.239ns 0.108ns 17.924ns 19.219ns 1.040 1.040 290.0 0.0
parallel_for_each.cor_empty 77527660 12.865ns 0.142ns 12.641ns 13.200ns 1.000 0.000 217.1 0.0
parallel_for_each.cor_immediate_1 69572605 14.309ns 0.165ns 14.144ns 14.944ns 1.000 0.000 252.1 0.0
parallel_for_each.cor_immediate_2 107586246 9.008ns 0.061ns 8.947ns 9.158ns 0.500 0.000 141.1 0.0
parallel_for_each.cor_immediate_10 311411990 3.202ns 0.034ns 3.166ns 3.237ns 0.100 0.000 42.6 0.0
parallel_for_each.cor_immediate_100 590374125 1.679ns 0.021ns 1.647ns 1.732ns 0.010 0.000 20.5 0.0
parallel_for_each.cor_suspend_1 12445753 81.196ns 0.349ns 80.847ns 82.260ns 5.000 5.000 1312.5 0.0
parallel_for_each.cor_suspend_2 19381720 52.191ns 0.345ns 51.846ns 52.967ns 3.000 3.000 808.3 0.0
parallel_for_each.cor_suspend_10 34650150 28.761ns 0.174ns 28.587ns 29.139ns 1.400 1.400 386.6 0.0
parallel_for_each.cor_suspend_100 56983806 17.377ns 0.091ns 17.253ns 17.467ns 1.040 1.040 291.7 0.0
parallel_for_each.cor_pfe_empty 95607956 10.486ns 0.020ns 10.438ns 10.663ns 1.000 0.000 224.1 0.0
parallel_for_each.cor_pfe_immediate_1 71656733 13.952ns 0.085ns 13.732ns 14.037ns 1.000 0.000 287.1 0.0
parallel_for_each.cor_pfe_immediate_2 125178974 7.943ns 0.024ns 7.905ns 7.991ns 0.500 0.000 154.1 0.0
parallel_for_each.cor_pfe_immediate_10 318302490 3.113ns 0.016ns 3.074ns 3.129ns 0.100 0.000 47.6 0.0
parallel_for_each.cor_pfe_immediate_100 576647082 1.702ns 0.007ns 1.682ns 1.780ns 0.010 0.000 23.6 0.0
parallel_for_each.cor_pfe_suspend_1 15403146 64.972ns 0.303ns 64.350ns 65.755ns 3.000 4.000 1057.4 0.0
parallel_for_each.cor_pfe_suspend_2 24078216 41.335ns 0.176ns 41.159ns 42.194ns 2.000 2.500 660.8 0.0
parallel_for_each.cor_pfe_suspend_10 40977510 24.604ns 0.322ns 24.184ns 24.926ns 1.300 1.300 357.3 0.0
parallel_for_each.cor_pfe_suspend_100 63697788 15.877ns 0.121ns 15.756ns 16.120ns 1.030 1.030 274.3 0.0

with this change

test iterations median mad min max allocs tasks inst cycles
parallel_for_each.empty 941031478 1.060ns 0.003ns 1.034ns 1.063ns 0.000 0.000 14.0 0.0
chain.then_value 36715776 27.663ns 0.302ns 27.198ns 28.073ns 1.063 1.094 314.6 0.0
chain.await_value 31325376 31.809ns 0.068ns 31.741ns 32.266ns 1.094 1.125 413.9 0.0
chain.then_exception 34227072 29.497ns 0.150ns 29.347ns 31.415ns 1.094 1.094 316.1 0.0
chain.await_exception 624448 1.547us 20.063ns 1.525us 1.578us 2.156 1.125 23327.4 0.0
parallel_for_each.immediate_1 545821525 1.821ns 0.009ns 1.812ns 1.861ns 0.000 0.000 33.0 0.0
parallel_for_each.immediate_2 551962056 1.809ns 0.013ns 1.794ns 1.843ns 0.000 0.000 31.0 0.0
parallel_for_each.immediate_10 560405380 1.799ns 0.003ns 1.795ns 1.984ns 0.000 0.000 19.8 0.0
parallel_for_each.immediate_100 597997818 1.663ns 0.001ns 1.652ns 1.664ns 0.000 0.000 17.4 0.0
parallel_for_each.suspend_1 12676688 78.742ns 0.890ns 77.852ns 80.320ns 5.000 5.000 1232.5 0.0
parallel_for_each.suspend_2 18717484 52.326ns 0.086ns 52.240ns 53.263ns 3.000 3.000 766.8 0.0
parallel_for_each.suspend_10 34439540 29.092ns 0.204ns 28.841ns 29.323ns 1.400 1.400 377.5 0.0
parallel_for_each.suspend_100 54461979 18.253ns 0.144ns 17.912ns 18.397ns 1.040 1.040 290.0 0.0
parallel_for_each.cor_empty 75567102 13.130ns 0.057ns 13.033ns 13.244ns 1.000 0.000 217.1 0.0
parallel_for_each.cor_immediate_1 68951106 14.555ns 0.049ns 14.489ns 14.613ns 1.000 0.000 252.1 0.0
parallel_for_each.cor_immediate_2 108151612 9.157ns 0.018ns 9.101ns 9.262ns 0.500 0.000 141.1 0.0
parallel_for_each.cor_immediate_10 295488810 3.359ns 0.006ns 3.353ns 3.368ns 0.100 0.000 42.6 0.0
parallel_for_each.cor_immediate_100 577104759 1.689ns 0.009ns 1.680ns 1.746ns 0.010 0.000 20.5 0.0
parallel_for_each.cor_suspend_1 11570679 83.838ns 0.424ns 82.937ns 84.406ns 5.000 5.000 1312.5 0.0
parallel_for_each.cor_suspend_2 19052154 52.438ns 0.190ns 52.190ns 53.355ns 3.000 3.000 808.3 0.0
parallel_for_each.cor_suspend_10 32605960 30.320ns 0.103ns 30.129ns 30.488ns 1.400 1.400 386.6 0.0
parallel_for_each.cor_suspend_100 54934110 18.172ns 0.035ns 18.138ns 18.456ns 1.040 1.040 291.7 0.0
parallel_for_each.cor_pfe_empty 92770584 10.854ns 0.086ns 10.758ns 11.255ns 1.000 0.000 224.1 0.0
parallel_for_each.cor_pfe_immediate_1 70022625 14.463ns 0.127ns 14.242ns 14.822ns 1.000 0.000 287.1 0.0
parallel_for_each.cor_pfe_immediate_2 122553590 8.184ns 0.056ns 8.128ns 8.357ns 0.500 0.000 154.1 0.0
parallel_for_each.cor_pfe_immediate_10 314188660 3.205ns 0.008ns 3.172ns 3.222ns 0.100 0.000 47.6 0.0
parallel_for_each.cor_pfe_immediate_100 585786267 1.694ns 0.008ns 1.683ns 1.703ns 0.010 0.000 23.6 0.0
parallel_for_each.cor_pfe_suspend_1 15343462 64.803ns 0.126ns 64.676ns 66.563ns 3.000 4.000 1057.4 0.0
parallel_for_each.cor_pfe_suspend_2 23104816 42.998ns 0.206ns 42.694ns 43.248ns 2.000 2.500 660.8 0.0
parallel_for_each.cor_pfe_suspend_10 38926460 25.904ns 0.173ns 25.730ns 26.712ns 1.300 1.300 357.3 0.0
parallel_for_each.cor_pfe_suspend_100 57833820 17.040ns 0.135ns 16.905ns 17.571ns 1.030 1.030 274.3 0.0

@tchaikov
Copy link
Contributor Author

the test failures are tracked by #2620

@mykaul
Copy link

mykaul commented Jan 16, 2025

It's a shame the test name isn't left-aligned, it's a bit harder to read it that way.

@tchaikov
Copy link
Contributor Author

It's a shame the test name isn't left-aligned, it's a bit harder to read it that way.

do you mean the column of "test"? they are. i guess the table in github's markdown is left-aligned by default.

@xemul
Copy link
Contributor

xemul commented Jan 16, 2025

@tchaikov , would you please rebase this PR to make CI green (#2618 is merged)

Right-align metrics columns in markdown output for better number comparison.
Previously, metrics were left-aligned in markdown tables but right-aligned
in stdout, making it difficult to visually compare numbers.

The change adds colons to the right of hyphens in the header row
(e.g. `|---:|`) to right-align entire columns. While this affects both
headers and data cells, the improved readability of numeric values
outweighs the minor tradeoff of right-aligned headers.

In short:
- Uses `column::print_text` with ":>" alignment for consistent formatting
- Maintains existing stdout_printer right alignment
- Updates `markdown_printer` alignment to match stdout behavior

Signed-off-by: Kefu Chai <[email protected]>
Move print_text_header() into stdout_printer::print_configuration() since
it's the only remaining caller. This simplifies the code by reducing
function indirection and keeping related functionality together.

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov
Copy link
Contributor Author

v2:

@tchaikov
Copy link
Contributor Author

@xemul hi Pavel, could you please take another look?

@xemul xemul closed this in c1af3ab Jan 17, 2025
@xemul xemul merged commit c1af3ab into scylladb:master Jan 17, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants