benchmark-sweet 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -1
- data/README.md +2 -4
- data/benchmark-sweet.gemspec +0 -1
- data/examples/benchmark_big_small.rb +0 -1
- data/examples/benchmark_big_split.rb +0 -1
- data/examples/benchmark_blank.rb +0 -1
- data/examples/benchmark_rpt_database.rb +0 -1
- data/examples/benchmark_simple_database.rb +0 -1
- data/lib/benchmark/sweet.rb +21 -3
- data/lib/benchmark/sweet/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d244cd69d99d599b4c6b7ae175ebcfa59b1c826ef66f643662bac4424d884f1b
|
4
|
+
data.tar.gz: 8350da53d68b067996858b52bdfbd5b9e7525d88042d099f0d68d443a00dc3c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 129add152f798180f6d7f3d76c294b7a8c78e8aa917a7c838c713a2177d339d3396b9155e0a253b96643207366e20377d9c61c219dc7f9088b0708356fa628c4
|
7
|
+
data.tar.gz: d618214ba5e14cf06c6c1ae323e7836514af96ebd39602fbf1c682be091ee8e20f1f755bc70a0756adddcddf3e4e5a794c45b14c2ce8a2ce8bdaac4933913de3
|
data/CHANGELOG.md
CHANGED
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
11
11
|
### Changed
|
12
12
|
|
13
13
|
### Fixed
|
14
|
+
- properly indent tables with iso color codes (thanks @d-m-u)
|
14
15
|
|
15
16
|
## [0.2.1] - 2020-06-24
|
16
17
|
|
@@ -37,6 +38,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
37
38
|
### Added
|
38
39
|
- good stuff
|
39
40
|
|
40
|
-
[Unreleased]: https://github.com/kbrock/benchmark-sweet/compare/v0.2.
|
41
|
+
[Unreleased]: https://github.com/kbrock/benchmark-sweet/compare/v0.2.2...HEAD
|
42
|
+
[0.2.2]: https://github.com/kbrock/benchmark-sweet/compare/v0.2.1...v0.2.2
|
41
43
|
[0.2.1]: https://github.com/kbrock/benchmark-sweet/compare/v0.2.0...v0.2.1
|
42
44
|
[0.2.0]: https://github.com/kbrock/benchmark-sweet/compare/v0.0.1...v0.2.0
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# Benchmark::Sweet
|
2
2
|
|
3
|
-
Time tends not to be consistent across multiple runs
|
3
|
+
Time tends not to be consistent across multiple runs, but numbers of queries or the number of objects allocated tend to be more similar.
|
4
4
|
|
5
5
|
This gem allows the user to collect all three of these benchmarks using a single framework similar to the benchmark and benchmark-ips syntax.
|
6
6
|
|
7
7
|
Sometimes a benchmark needs to be collected across multiple runs using different gem versions or using different ruby versions. This can be done as well.
|
8
8
|
|
9
|
-
Lastly, this allows multiple axes of comparisons to be performed. Example: instead of measuring multiple split implementations, it allows measuring these implementations using empty strings and long strings
|
9
|
+
Lastly, this allows multiple axes of comparisons to be performed. Example: instead of measuring multiple split implementations, it allows measuring these implementations using empty strings and long strings so a bigger picture can be obtained.
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
@@ -31,7 +31,6 @@ Or install it yourself as:
|
|
31
31
|
```ruby
|
32
32
|
require "benchmark/sweet"
|
33
33
|
require "active_support/all"
|
34
|
-
require "more_core_extensions/all" # [].tabelize
|
35
34
|
|
36
35
|
NSTRING = nil
|
37
36
|
DELIMITER='/'.freeze
|
@@ -107,7 +106,6 @@ This is not a native value, it is specified when the items are specified (e.g.:`
|
|
107
106
|
```ruby
|
108
107
|
require "benchmark/sweet"
|
109
108
|
require "active_support/all"
|
110
|
-
require "more_core_extensions/all" # [].tabelize
|
111
109
|
|
112
110
|
NSTRING = nil
|
113
111
|
DELIMITER='/'.freeze
|
data/benchmark-sweet.gemspec
CHANGED
@@ -43,6 +43,5 @@ EOF
|
|
43
43
|
|
44
44
|
spec.add_runtime_dependency "benchmark-ips", "~> 2.8.2"
|
45
45
|
spec.add_runtime_dependency "memory_profiler", "~> 0.9.0"
|
46
|
-
spec.add_runtime_dependency "more_core_extensions" # for [].tabelize - want to remove
|
47
46
|
spec.add_runtime_dependency "activesupport" # for {}.symbolize_keys! - want to remove
|
48
47
|
end
|
data/examples/benchmark_blank.rb
CHANGED
data/lib/benchmark/sweet.rb
CHANGED
@@ -84,10 +84,28 @@ module Benchmark
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def self.print_table(header_name, header_value, table_rows)
|
87
|
-
require "more_core_extensions" # defines tableize
|
88
87
|
puts "", "#{header_name} #{header_value}", "" if header_value
|
89
|
-
|
90
|
-
|
88
|
+
to_table(table_rows)
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.to_table(arr)
|
92
|
+
field_sizes = Hash.new
|
93
|
+
arr.each { |row| field_sizes.merge!(row => row.map { |iterand| iterand[1].to_s.gsub(/\e\[[^m]+m/, '').length } ) }
|
94
|
+
|
95
|
+
column_sizes = arr.reduce([]) do |lengths, row|
|
96
|
+
row.each_with_index.map { |iterand, index| [lengths[index] || 0, field_sizes[row][index]].max }
|
97
|
+
end
|
98
|
+
|
99
|
+
format = column_sizes.collect {|n| "%#{n}s" }.join(" | ")
|
100
|
+
format += "\n"
|
101
|
+
|
102
|
+
printf format, *arr[0].each_with_index.map { |el, i| " "*(column_sizes[i] - field_sizes[arr[0]][i] ) + el[0].to_s }
|
103
|
+
|
104
|
+
printf format, *column_sizes.collect { |w| "-" * w }
|
105
|
+
|
106
|
+
arr[0..arr.count].each do |line|
|
107
|
+
printf format, *line.each_with_index.map { |el, i| " "*(column_sizes[i] - field_sizes[line][i] ) + el[1].to_s }
|
108
|
+
end
|
91
109
|
end
|
92
110
|
end
|
93
111
|
extend Benchmark::Sweet
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benchmark-sweet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keenan Brock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.9.0
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: more_core_extensions
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: activesupport
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|