Export to markdown

It is possible to export results from PkgBenchmark.BenchmarkResults and PkgBenchmark.BenchmarkJudgement using the function export_markdown

PkgBenchmark.export_markdownFunction
export_markdown(file::String, results::BenchmarkResults)
export_markdown(io::IO,       results::BenchmarkResults)
export_markdown(file::String, results::BenchmarkJudgement; export_invariants=false)
export_markdown(io::IO,       results::BenchmarkJudgement; export_invariants=false)

Writes the results to file or io in markdown format.

When exporting a BenchmarkJudgement, by default only the results corresponding to possible regressions or improvements will be included. To also export the invariant results, set export_invariants=true.

See also: BenchmarkResults, BenchmarkJudgement

source

Using Github.jl to upload the markdown to a Gist

Assuming that we have gotten a BenchmarkResults or BenchmarkJudgement from a benchmark, we can then use GitHub.jl to programmatically upload the exported markdown to a gist:

julia> using GitHub, JSON, PkgBenchmark

julia> results = benchmarkpkg("PkgBenchmark");

julia> gist_json = JSON.parse(
            """
            {
            "description": "A benchmark for PkgBenchmark",
            "public": false,
            "files": {
                "benchmark.md": {
                "content": "$(escape_string(sprint(export_markdown, results)))"
                }
            }
            }
            """
        )

julia> posted_gist = create_gist(params = gist_json);

julia> url = get(posted_gist.html_url)
URI(https://gist.github.com/317378b4fcf2fb4c5585b104c3b177a8)
Note

Consider using an extension to your browser to make the gist webpage use full width in order for the tables in the gist to render better, see e.g here.