benchable 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8cc2eab98fd2843682811029e789c3d50f28cef0cab9e607936700579e65cf6
4
- data.tar.gz: 38f5b868dece18aaf0567603346ff9677b998486c12236a6915cfbedac0ead13
3
+ metadata.gz: 53c01c57feaf90f0e66348f0c9616fb0d7b14ef6c113275994b3c7d73904f6e9
4
+ data.tar.gz: f29e837f82bcc9249759def201b971945f7d9eff2137effc36f0401a01180184
5
5
  SHA512:
6
- metadata.gz: 555bcfbff720e4f8044504d7055da3b265f3adf0ad73ba8039dd6f3cc31de82cce6932ce100934ddc72356c2e59021334fa9f83eab31f3e9d090f5d9d88d7aed
7
- data.tar.gz: dbc3b735b5400fa4cd948bc4535cb2a5d2998463b8411b72cd569171dff21058bd89bb6d9c73a2f58d5cd3fdfe4470fbc1d636832c3fa5bbf00b45075afefbb1
6
+ metadata.gz: e8fd398efe20aa3d49066d7a49dffc5db82c8a31a2aac961a117f37d472ed3a2c2db80a1b227633ff6344e4c0af5ee657bce8cf83b0199507b0af1cddadd1941
7
+ data.tar.gz: 2f88177d45d8ec82b0732b0b32c2156a6d24a7fc8a1bdd30402e8afe4a61d4618982fea4e6e8a7bff7b3175bde53bfe89d2a0c081f09bb151012648c2eb38966
data/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [Unreleased]
9
9
  ---
10
10
 
11
+ ## [0.3.1] - 2021-09-10
12
+
13
+ ### Changed
14
+
15
+ - Fix benchmark arguments for Benchmark::Memory.
16
+
11
17
  ## [0.3.0] - 2021-09-09
12
18
 
13
19
  ### Added
@@ -52,7 +58,8 @@ end
52
58
  ### Added
53
59
  - Support for `Benchmark.bm`, `Benchmark.bmbm` and `Benchmark.ips`.
54
60
 
55
- [unreleased]: https://github.com/MatheusRich/benchable/compare/v0.3.0...HEAD
61
+ [unreleased]: https://github.com/MatheusRich/benchable/compare/v0.3.1...HEAD
56
62
  [0.1.0]: https://github.com/MatheusRich/benchable/releases/tag/v0.1.0
57
63
  [0.2.0]: https://github.com/MatheusRich/benchable/releases/tag/v0.2.0
58
- [0.3.0]: https://github.com/MatheusRich/benchable/releases/tag/v0.3.0
64
+ [0.3.0]: https://github.com/MatheusRich/benchable/releases/tag/v0.3.0
65
+ [0.3.1]: https://github.com/MatheusRich/benchable/releases/tag/v0.3.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- benchable (0.2.0)
4
+ benchable (0.3.1)
5
5
  benchmark-ips (~> 2.8, >= 2.8.2)
6
6
  benchmark-memory (~> 0.1.2)
7
7
 
@@ -139,4 +139,4 @@ DEPENDENCIES
139
139
  yard (~> 0.9.25)
140
140
 
141
141
  BUNDLED WITH
142
- 2.1.4
142
+ 2.2.25
data/README.md CHANGED
@@ -123,7 +123,7 @@ You can provide benchmark options by passing a hash to the `Benchable.bench` met
123
123
 
124
124
  #### Options for `Benchmark.bm` and `Benchmark.bmbm`
125
125
 
126
- On `bm` and `bmbm` benchmarks the only available option is `width`, which specifies the leading spaces for labels on each line. The default width is `20`.
126
+ The only available option is `width` on `bm` and `bmbm` benchmarks, which specifies the leading spaces for labels on each line. The default width is `20`.
127
127
 
128
128
  ```ruby
129
129
  Benchable.bench(width: 25) do
@@ -133,7 +133,7 @@ end
133
133
 
134
134
  #### Options for `Benchmark::IPS`
135
135
 
136
- If you're using `::IPS`, you can pass any option accepted by `Benchmark::IPS`' `config` method.
136
+ If you're using `::IPS`, you can pass any option accepted by `Benchmark::IPS`'s `config` method.
137
137
 
138
138
  ```ruby
139
139
  Benchable.bench(:ips, time: 5, warmup: 2) do
@@ -12,7 +12,7 @@ module Benchable
12
12
  DEFAULT_WIDTH = 20
13
13
  BENCHMARK_TYPES = %i[bm bmbm ips memory].freeze
14
14
 
15
- def initialize(benchmark_type, options = {})
15
+ def initialize(benchmark_type, **options)
16
16
  @benchmark_type = benchmark_type
17
17
  @options = options
18
18
 
@@ -53,7 +53,7 @@ module Benchable
53
53
 
54
54
  def run_benchmark
55
55
  benchmark do |b|
56
- b.config(**options) if benchmark_type == :ips
56
+ b.config(options) if benchmark_type == :ips
57
57
 
58
58
  cases.each do |benchmark_case|
59
59
  b.report(name_for(benchmark_case)) do
@@ -70,17 +70,19 @@ module Benchable
70
70
  end
71
71
 
72
72
  def benchmark(&block)
73
- ::Benchmark.public_send(*benchmark_args, &block)
73
+ if benchmark_type == :memory
74
+ ::Benchmark.public_send(benchmark_type, **benchmark_args, &block)
75
+ else
76
+ ::Benchmark.public_send(benchmark_type, *benchmark_args, &block)
77
+ end
74
78
  end
75
79
 
76
80
  def benchmark_args
77
- width = options[:width] || DEFAULT_WIDTH
78
-
79
- args = [benchmark_type]
80
- args << width unless benchmark_type == :memory
81
- args << options if benchmark_type == :memory
82
-
83
- args
81
+ if benchmark_type == :memory
82
+ options.slice(:quiet)
83
+ else
84
+ options[:width] || DEFAULT_WIDTH
85
+ end
84
86
  end
85
87
  end
86
88
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Benchable
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matheus Richard