benchmark-perf 0.1.0 → 0.1.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
  SHA1:
3
- metadata.gz: b05020c28d534d0348e045bb0778e18ecabd5236
4
- data.tar.gz: bcf5fdf5efbca164cce07a5718c01000d32f4671
3
+ metadata.gz: 701d132071e0459dc7526e5bcb7f0fce1c505b70
4
+ data.tar.gz: f765203b7e2b4f132782c44c027a2853aa7c3162
5
5
  SHA512:
6
- metadata.gz: f8392ae93fa4f2e48de3c41fb987a188b781410b690f8bcf8c47df9ee019ffdced40de4f424c587c6ada25237909ca018593523321da2077c03e619c49db2d5f
7
- data.tar.gz: 5fa5b6298532e8936b85e615a2e0b1ce748e1cedb209e22621ec7313611f017b80627aa522977f65736668889caeb3380eca65cdb45a814fe011d7528e1121ad
6
+ metadata.gz: 37a9d93cfad38d010814a44c77483bce25c7237c4dee9547d980dec8be0ded2ba5c180ddc22457edd9944e1d99e7472d3b669d217bd42c93efaf6c51f465d11e
7
+ data.tar.gz: b9554efaa85360ae97e4d9ab7f74bbb1950c869e712cfc5cfda3562f753e4c18a34d715a4aa9efb0a4a07efa9852b7e811d39c1ccf37930500c89271aec19a91
data/.travis.yml CHANGED
@@ -2,23 +2,22 @@
2
2
  language: ruby
3
3
  sudo: false
4
4
  cache: bundler
5
- bundler_args: --without yard benchmarks
6
5
  script: "bundle exec rake ci"
7
6
  rvm:
8
- - 1.9.3
9
- - 2.0
10
- - 2.1
11
- - 2.2
7
+ - 2.0.0
8
+ - 2.1.10
9
+ - 2.2.5
10
+ - 2.3.1
12
11
  - ruby-head
13
- - jruby-19mode
14
- - jruby
12
+ - jruby-9.1.1.0
15
13
  - jruby-head
16
- - rbx-2
14
+ - rbx-3.60
17
15
  env:
18
16
  global:
19
17
  - JRUBY_OPTS="-Xcli.debug=true --debug"
20
18
  matrix:
21
19
  allow_failures:
20
+ - rvm: rbx-3.60
22
21
  - rvm: ruby-head
23
22
  - rvm: jruby-head
24
23
  fast_finish: true
data/CHANGELOG.md CHANGED
@@ -1,7 +1,13 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.1.1] - 2016-10-29
4
+
5
+ ### Fixed
6
+ * Fix marshalling of time when measuring execution
7
+
3
8
  ## [v0.1.0] - 2016-01-25
4
9
 
5
10
  Initial release
6
11
 
12
+ [v0.1.1]: https://github.com/peter-murach/benchmark-perf/compare/v0.1.0...v0.1.1
7
13
  [v0.1.0]: https://github.com/peter-murach/benchmark-perf/compare/v0.1.0
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :development do
6
- gem 'rspec', '~> 3.4.0'
6
+ gem 'rspec', '~> 3.5.0'
7
7
  gem 'yard', '~> 0.8.7'
8
8
  end
9
9
 
data/README.md CHANGED
@@ -1,20 +1,20 @@
1
1
  # Benchmark::Perf
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/benchmark-perf.svg)][gem]
4
- [![Build Status](https://secure.travis-ci.org/peter-murach/benchmark-perf.svg?branch=master)][travis]
5
- [![Code Climate](https://codeclimate.com/github/peter-murach/benchmark-perf/badges/gpa.svg)][codeclimate]
6
- [![Coverage Status](https://coveralls.io/repos/github/peter-murach/benchmark-perf/badge.svg?branch=master)][coverage]
7
- [![Inline docs](http://inch-ci.org/github/peter-murach/benchmark-perf.svg?branch=master)][inchpages]
4
+ [![Build Status](https://secure.travis-ci.org/piotrmurach/benchmark-perf.svg?branch=master)][travis]
5
+ [![Code Climate](https://codeclimate.com/github/piotrmurach/benchmark-perf/badges/gpa.svg)][codeclimate]
6
+ [![Coverage Status](https://coveralls.io/repos/github/piotrmurach/benchmark-perf/badge.svg?branch=master)][coverage]
7
+ [![Inline docs](http://inch-ci.org/github/piotrmurach/benchmark-perf.svg?branch=master)][inchpages]
8
8
 
9
9
  [gem]: http://badge.fury.io/rb/benchmark-perf
10
- [travis]: http://travis-ci.org/peter-murach/benchmark-perf
11
- [codeclimate]: https://codeclimate.com/github/peter-murach/benchmark-perf
12
- [coverage]: https://coveralls.io/github/peter-murach/benchmark-perf?branch=master
13
- [inchpages]: http://inch-ci.org/github/peter-murach/benchmark-perf
10
+ [travis]: http://travis-ci.org/piotrmurach/benchmark-perf
11
+ [codeclimate]: https://codeclimate.com/github/piotrmurach/benchmark-perf
12
+ [coverage]: https://coveralls.io/github/piotrmurach/benchmark-perf?branch=master
13
+ [inchpages]: http://inch-ci.org/github/piotrmurach/benchmark-perf
14
14
 
15
15
  > Measure execution time and iterations per second.
16
16
 
17
- The **Benchmark::Perf** is used by [rspec-benchmark](https://github.com/peter-murach/rspec-benchmark)
17
+ The **Benchmark::Perf** is used by [rspec-benchmark](https://github.com/piotrmurach/rspec-benchmark)
18
18
 
19
19
  ## Installation
20
20
 
@@ -62,7 +62,7 @@ mean, stddev, iter, elapsed_time = bench.run { ... }
62
62
 
63
63
  ## Contributing
64
64
 
65
- 1. Fork it ( https://github.com/[my-github-username]/benchmark-perf/fork )
65
+ 1. Fork it ( https://github.com/piotrmurach/benchmark-perf/fork )
66
66
  2. Create your feature branch (`git checkout -b my-new-feature`)
67
67
  3. Commit your changes (`git commit -am 'Add some feature'`)
68
68
  4. Push to the branch (`git push origin my-new-feature`)
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Benchmark
4
4
  module Perf
5
+ MarshalError = Class.new(StandardError)
6
+
5
7
  # Measure length of time the work could take on average
6
8
  #
7
9
  # @api public
@@ -49,19 +51,24 @@ module Benchmark
49
51
  pid = Process.fork do
50
52
  GC.start
51
53
  GC.disable if ENV['BENCH_DISABLE_GC']
52
- reader.close
53
54
 
55
+ reader.close
54
56
  time = yield
55
57
 
56
58
  io.print "%9.6f" % time if io
57
- writer.write(Marshal.dump(time))
59
+ Marshal.dump(time, writer)
60
+
58
61
  GC.enable if ENV['BENCH_DISABLE_GC']
59
62
  exit!(0) # run without hooks
60
63
  end
61
64
 
62
- writer.close
65
+ writer.close unless writer.closed?
63
66
  Process.waitpid(pid)
64
- Marshal.load(reader.read)
67
+ begin
68
+ Marshal.load(reader)
69
+ rescue => e
70
+ raise MarshalError, "#{e.class}: #{e.message}"
71
+ end
65
72
  end
66
73
 
67
74
  # Run warmup measurement
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Benchmark
4
4
  module Perf
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end # Perf
7
7
  end # Benchmark
@@ -17,6 +17,12 @@ RSpec.describe Benchmark::Perf::ExecutionTime do
17
17
  expect(sample).to all(be < 0.01)
18
18
  end
19
19
 
20
+ it "measures complex object" do
21
+ bench = described_class.new
22
+ sample = bench.run { {foo: Object.new, bar: :piotr} }
23
+ expect(sample).to all(be < 0.001)
24
+ end
25
+
20
26
  it "executes code to warmup ruby vm" do
21
27
  bench = described_class.new
22
28
  sample = bench.run_warmup { 'x' * 1_000_000 }
metadata CHANGED
@@ -1,47 +1,47 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchmark-perf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.5.0
20
- - - <
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '2.0'
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: 1.5.0
30
- - - <
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - '>='
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  description: Execution time and iteration performance benchmarking
@@ -51,9 +51,9 @@ executables: []
51
51
  extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
- - .gitignore
55
- - .rspec
56
- - .travis.yml
54
+ - ".gitignore"
55
+ - ".rspec"
56
+ - ".travis.yml"
57
57
  - CHANGELOG.md
58
58
  - Gemfile
59
59
  - LICENSE.txt
@@ -82,17 +82,17 @@ require_paths:
82
82
  - lib
83
83
  required_ruby_version: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - '>='
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - '>='
90
+ - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.0.3
95
+ rubygems_version: 2.5.1
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Execution time and iteration performance benchmarking