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

Misc doc changes from kianmeng #61

Merged
merged 6 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
/tools
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`!
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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) [![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/)!

Expand All @@ -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)
Expand Down Expand Up @@ -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.
26 changes: 13 additions & 13 deletions lib/benchee/formatters/html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 26 additions & 9 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
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,
version: @version,
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,
Expand All @@ -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

Expand Down Expand Up @@ -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