Skip to content

Commit

Permalink
Merge f6b27dd into a8fd6db
Browse files Browse the repository at this point in the history
  • Loading branch information
devonestes authored Jul 26, 2018
2 parents a8fd6db + f6b27dd commit 0a8e5b1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
elixir 1.6.4
erlang 20.3
elixir 1.6.6
erlang 21.0
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ language: elixir
elixir:
- 1.4.5
- 1.5.3
- 1.6.4
- 1.6.6
otp_release:
- 19.3
- 20.3
- 21.0

matrix:
exclude:
- elixir: 1.4.5
otp_release: 21.0
- elixir: 1.5.3
otp_release: 21.0

before_script:
- MIX_ENV=test mix compile --warnings-as-errors
Expand Down
2 changes: 2 additions & 0 deletions test/benchee/benchmark/measure/memory_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ defmodule Benchee.MemoryMeasureTest do
@moduletag :memory_measure

describe "measure/1" do

@tag :otp_21_memory_problems
test "returns the result of the function and the memory used (in bytes)" do
fun_to_run = fn -> Enum.to_list(1..10) end
assert {memory_used, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]} = Memory.measure(fun_to_run)
Expand Down
1 change: 1 addition & 0 deletions test/benchee/benchmark/runner_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ defmodule Benchee.Benchmark.RunnerTest do
end

@tag :memory_measure
@tag :otp_21_memory_problems
test "correctly scales down memory usage of very fast functions" do
suite = test_suite(%Suite{configuration: %{time: 0.0, warmup: 1, memory_time: 1_000_000}})

Expand Down
1 change: 1 addition & 0 deletions test/benchee_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ defmodule BencheeTest do
assert output =~ ~r/memory.+statistics/i
end

@tag :otp_21_memory_problems
test "the micro keyword list code from Michal does not break memory measurements #213" do
benches = %{
"delete old" => fn {kv, key} -> BenchKeyword.delete_v0(kv, key) end,
Expand Down
7 changes: 7 additions & 0 deletions test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
otp_release = List.to_integer(:erlang.system_info(:otp_release))
exclusions = if otp_release > 18, do: [], else: [memory_measure: true]

# See #234
exclusions = if otp_release >= 21 do
[{:otp_21_memory_problems, true} | exclusions]
else
exclusions
end

# On Windows we have by far worse time measurements (millisecond level)
# see: https://github.com/PragTob/benchee/pull/195#issuecomment-377010006
{_, os} = :os.type()
Expand Down

0 comments on commit 0a8e5b1

Please sign in to comment.