这是indexloc提供的服务,不要输入任何密码
Skip to content

Comparison outputs should be colorful when pasted into GitHub #238

@bernhardmgruber

Description

@bernhardmgruber

Copying and pasting a markdown comparison report to GitHub will render as tables and look like this:

T{ct} OffsetT{ct} Elements{io} Ref Time Ref Noise Cmp Time Cmp Noise Diff %Diff Status
I8 I32 2^16 6.092 us 7.97% 6.189 us 9.24% 0.097 us 1.60% SAME
I8 I32 2^20 6.703 us 11.35% 7.095 us 12.43% 0.391 us 5.84% SAME
I8 I32 2^24 14.092 us 2.18% 16.161 us 2.11% 2.068 us 14.68% SLOW
I8 I32 2^28 115.971 us 0.72% 128.828 us 0.24% 12.857 us 11.09% SLOW

Sometimes, pasting as preformatted text is denser:

|  T{ct}  |  OffsetT{ct}  |  Elements{io}  |   Ref Time |   Ref Noise |   Cmp Time |   Cmp Noise |      Diff |   %Diff |  Status  |
|---------|---------------|----------------|------------|-------------|------------|-------------|-----------|---------|----------|
|   I8    |      I32      |      2^16      |   6.092 us |       7.97% |   6.189 us |       9.24% |  0.097 us |   1.60% |   SAME   |
|   I8    |      I32      |      2^20      |   6.703 us |      11.35% |   7.095 us |      12.43% |  0.391 us |   5.84% |   SAME   |
|   I8    |      I32      |      2^24      |  14.092 us |       2.18% |  16.161 us |       2.11% |  2.068 us |  14.68% |   SLOW   |
|   I8    |      I32      |      2^28      | 115.971 us |       0.72% | 128.828 us |       0.24% | 12.857 us |  11.09% |   SLOW   |

(a bit wider but less long)

Both versions loose color though, which makes reading the benchmarks on GitHub harder. The console output contained colors. We should find a way to make GitHub render the comparison output with colors as well. One way to do this, is to abuse the diff highlighting and prepend lines with +, -, etc.:

 |  T{ct}  |  OffsetT{ct}  |  Elements{io}  |   Ref Time |   Ref Noise |   Cmp Time |   Cmp Noise |      Diff |   %Diff |  Status  |
 |---------|---------------|----------------|------------|-------------|------------|-------------|-----------|---------|----------|
 |   I8    |      I32      |      2^16      |   6.092 us |       7.97% |   6.189 us |       9.24% |  0.097 us |   1.60% |   SAME   |
!|   I8    |      I32      |      2^20      |   6.703 us |      11.35% |   7.095 us |      12.43% |  0.391 us |   5.84% |   SAME   |
-|   I8    |      I32      |      2^24      |  14.092 us |       2.18% |  16.161 us |       2.11% |  2.068 us |  14.68% |   SLOW   |
+|   I8    |      I32      |      2^28      | 115.971 us |       0.72% | 128.828 us |       0.24% | 12.857 us |  11.09% |   SLOW   |

Kudos to @miscco for the idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions