From f1257f9b59aa3dd8bb2eede834eca4ca5fa7534b Mon Sep 17 00:00:00 2001 From: Tobias Pfeiffer Date: Sun, 10 Dec 2023 10:03:26 +0100 Subject: [PATCH 1/6] Adjust .gitignore See #57 @kianmeng --- .gitignore | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 3115908..120d980 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,36 @@ # The directory Mix will write compiled artifacts to. -/_build +/_build/ # If you run "mix test --cover", coverage assets end up here. -/cover +/cover/ # The directory Mix downloads your dependencies sources to. -/deps +/deps/ # Where 3rd-party dependencies like ExDoc output generated docs. -/doc +/doc/ # If the VM crashes, it generates a dump, let's ignore it too. erl_crash.dump +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# Ignore package tarball (built via "mix hex.build"). +benchee_html-*.tar + # Also ignore archive artifacts (built via "mix archive.build"). *.ez + +# Temporary files for e.g. tests. +/tmp/ + +# Misc. +my.json my.html /samples_output /output /benchmarks/output # dialyzer caching -/tools \ No newline at end of file +/tools From 3b4d29c9274220fdd7391217018a182116c97254 Mon Sep 17 00:00:00 2001 From: Tobias Pfeiffer Date: Sun, 10 Dec 2023 10:04:45 +0100 Subject: [PATCH 2/6] Be more explicit about Changelog and format See #57 by @kianmeng --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 275b2d1..5bcfad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + ## 1.1.0 (unreleased) Memory blowing up on formatting? Try `sequential_output/2`! From 2129891061359711778b787abb0590c2572d6cc1 Mon Sep 17 00:00:00 2001 From: Tobias Pfeiffer Date: Sun, 10 Dec 2023 10:08:09 +0100 Subject: [PATCH 3/6] Fix build badge as we are running on github actions now --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba1ad96..8ed3844 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# benchee_html [![Hex Version](https://img.shields.io/hexpm/v/benchee_html.svg)](https://hex.pm/packages/benchee_html) [![Build Status](https://travis-ci.org/bencheeorg/benchee_html.svg?branch=master)](https://travis-ci.org/bencheeorg/benchee_html) [![Coverage Status](https://coveralls.io/repos/github/bencheeorg/benchee_html/badge.svg?branch=master)](https://coveralls.io/github/bencheeorg/benchee_html?branch=master) +# benchee_html [![Hex Version](https://img.shields.io/hexpm/v/benchee_html.svg)](https://hex.pm/packages/benchee_html) [![CI](https://github.com/bencheeorg/benchee_html/actions/workflows/main.yml/badge.svg)](https://github.com/bencheeorg/benchee_html/actions/workflows/main.yml) [![Coverage Status](https://coveralls.io/repos/github/bencheeorg/benchee_html/badge.svg?branch=master)](https://coveralls.io/github/bencheeorg/benchee_html?branch=master) Formatter for [benchee](//github.com/PragTob/benchee) to produce some standalone HTML with nice graphs, a data table etc. from your benchee benchmarking results :) Also allows you to export PNG images, the graphs are also somewhat explorable thanks to [plotly.js](https://plot.ly/javascript/)! From dd2858fd8bb6a33166e3699c91f1133687a15b72 Mon Sep 17 00:00:00 2001 From: Tobias Pfeiffer Date: Sun, 10 Dec 2023 10:10:27 +0100 Subject: [PATCH 4/6] README adjustments Mostly see #57 by @kianmeng I like the badges elsewhere and don't want to put focus on when a library was last updated though. --- README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8ed3844..4a3272d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# benchee_html [![Hex Version](https://img.shields.io/hexpm/v/benchee_html.svg)](https://hex.pm/packages/benchee_html) [![CI](https://github.com/bencheeorg/benchee_html/actions/workflows/main.yml/badge.svg)](https://github.com/bencheeorg/benchee_html/actions/workflows/main.yml) [![Coverage Status](https://coveralls.io/repos/github/bencheeorg/benchee_html/badge.svg?branch=master)](https://coveralls.io/github/bencheeorg/benchee_html?branch=master) +# benchee_html [![Hex Version](https://img.shields.io/hexpm/v/benchee_html.svg)](https://hex.pm/packages/benchee_html) [![CI](https://github.com/bencheeorg/benchee_html/actions/workflows/main.yml/badge.svg)](https://github.com/bencheeorg/benchee_html/actions/workflows/main.yml) [![Coverage Status](https://coveralls.io/repos/github/bencheeorg/benchee_html/badge.svg?branch=master)](https://coveralls.io/github/bencheeorg/benchee_html?branch=master) [![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/benchee_html/) [![Total Download](https://img.shields.io/hexpm/dt/benchee_html.svg)](https://hex.pm/packages/benchee_html) [![License](https://img.shields.io/hexpm/l/benchee_html.svg)](https://github.com/bencheeorg/benchee_html/blob/master/LICENSE) Formatter for [benchee](//github.com/PragTob/benchee) to produce some standalone HTML with nice graphs, a data table etc. from your benchee benchmarking results :) Also allows you to export PNG images, the graphs are also somewhat explorable thanks to [plotly.js](https://plot.ly/javascript/)! @@ -10,17 +10,19 @@ It not only generates HTML but also assets and into the same folder. You can jus ## Installation -Add `benchee_html` to your list of dependencies in `mix.exs`: +Add `:benchee_html` to your list of dependencies in `mix.exs`: ```elixir def deps do - [{:benchee_html, "~> 1.0", only: :dev}] + [ + {:benchee_html, "~> 1.0", only: :dev} + ] end ``` ## Usage -Just use it as a formatter for [benchee](github.com/PragTob/benchee): +Just use it as a formatter for [benchee](https://github.com/PragTob/benchee): ```elixir list = Enum.to_list(1..10_000) @@ -140,3 +142,10 @@ A couple of (hopefully) helpful points: * `mix deps.get` to install dependencies * `mix test` to run tests * `mix credo` or `mix credo --strict` to find code style problems (not too strict with the 80 width limit for sample output in the docs) + +## Copyright and License + +Copyright (c) 2016 Tobias Pfeiffer + +This library is released under the MIT License. See the [LICENSE.md](./LICENSE.md) file +for further details. From 4f0901addd2944449e7e35e655afd0d8b6b96d44 Mon Sep 17 00:00:00 2001 From: Tobias Pfeiffer Date: Sun, 10 Dec 2023 10:11:36 +0100 Subject: [PATCH 5/6] Properly indent code for highlighting See #57 by @kianmeng --- lib/benchee/formatters/html.ex | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/benchee/formatters/html.ex b/lib/benchee/formatters/html.ex index d36facf..971fc5f 100644 --- a/lib/benchee/formatters/html.ex +++ b/lib/benchee/formatters/html.ex @@ -5,19 +5,19 @@ defmodule Benchee.Formatters.HTML do ## Examples - list = Enum.to_list(1..10_000) - map_fun = fn(i) -> [i, i * i] end - - Benchee.run( - %{ - "flat_map" => fn -> Enum.flat_map(list, map_fun) end, - "map.flatten" => fn -> list |> Enum.map(map_fun) |> List.flatten() end - }, - formatters: [ - Benchee.Formatters.Console, - {Benchee.Formatters.HTML, file: "samples_output/flat_map.html"} - ] - ) + list = Enum.to_list(1..10_000) + map_fun = fn(i) -> [i, i * i] end + + Benchee.run( + %{ + "flat_map" => fn -> Enum.flat_map(list, map_fun) end, + "map.flatten" => fn -> list |> Enum.map(map_fun) |> List.flatten() end + }, + formatters: [ + Benchee.Formatters.Console, + {Benchee.Formatters.HTML, file: "samples_output/flat_map.html"} + ] + ) """ @behaviour Benchee.Formatter From 53ec472229ce91ae92213a255cdd732535a7cc6c Mon Sep 17 00:00:00 2001 From: Tobias Pfeiffer Date: Sun, 10 Dec 2023 10:16:01 +0100 Subject: [PATCH 6/6] mix.exs updates for consistency and more data Mostly see #57 by @kianmeng Decided to point the changelog to github though, as unreleased changes are visible there which may come in helpful. --- mix.exs | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/mix.exs b/mix.exs index a89a7f1..9a4df9d 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,9 @@ defmodule BencheeHTML.Mixfile do use Mix.Project + @source_url "https://github.com/PragTob/benchee_html" @version "1.0.0" + def project do [ app: :benchee_html, @@ -9,10 +11,9 @@ defmodule BencheeHTML.Mixfile do elixir: "~> 1.6", build_embedded: Mix.env() == :prod, start_permanent: Mix.env() == :prod, - docs: [source_ref: @version], deps: deps(), + docs: docs(), package: package(), - test_coverage: [tool: ExCoveralls], preferred_cli_env: [ coveralls: :test, "coveralls.detail": :test, @@ -25,11 +26,7 @@ defmodule BencheeHTML.Mixfile do plt_file: {:no_warn, "tools/plts/benchee.plt"} ], name: "benchee_html", - source_url: "https://github.com/PragTob/benchee_html", - description: """ - HTML formatter with pretty graphs for the (micro) benchmarking library benchee. - Also allows export as PNG image! - """ + test_coverage: [tool: ExCoveralls] ] end @@ -64,13 +61,33 @@ defmodule BencheeHTML.Mixfile do defp package do [ + description: """ + HTML formatter with pretty graphs for the (micro) benchmarking library benchee. + Also allows export as PNG image! + """, files: ["priv", "lib", "mix.exs", "README.md"], maintainers: ["Tobias Pfeiffer"], licenses: ["MIT"], links: %{ - "github" => "https://github.com/PragTob/benchee_html", - "Blog posts" => "https://pragtob.wordpress.com/tag/benchee/" + "Blog posts" => "https://pragtob.wordpress.com/tag/benchee/", + "Changelog" => "https://github.com/bencheeorg/benchee_html/blob/main/CHANGELOG.md", + "GitHub" => @source_url } ] end + + defp docs do + [ + extras: [ + "CHANGELOG.md", + "CODE_OF_CONDUCT.md": [title: "Code of Conduct"], + "LICENSE.md": [title: "License"], + "README.md": [title: "Overview"] + ], + main: "readme", + source_url: @source_url, + source_ref: @version, + formatters: ["html"] + ] + end end