micro_bench 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/micro_bench/version.rb +1 -1
- data/lib/micro_bench.rb +1 -1
- data/spec/micro_bench/micro_bench_spec.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eeb98130357a3e9320237286d468300c1731a76
|
4
|
+
data.tar.gz: 1a5a9887fc7c0b9600c453565cb3496db58e2de5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 958052ea9ea084cc0bcba112f41e6de68d9395d5d4e711c0ccc394ad4c82e628463bbd18cd0c1b231c5f906e42c682b7d191aa59a698283d0316d95b549e39fe
|
7
|
+
data.tar.gz: 6dc33d748019010708d9676bc793717a4e54289e11eb74344478384d48b638077164e6a97a41230a1119f5545a492fb3c2e7fd984bab51d08dafac2f44f4c090
|
data/README.md
CHANGED
@@ -32,6 +32,8 @@ puts "Method 1 duration : #{MicroBench.duration} seconds"
|
|
32
32
|
method_2(foo)
|
33
33
|
```
|
34
34
|
|
35
|
+
**WARNING : This is still beta code and may not be suitable for production usage. While still in beta, API may be subject to breaking changes on MINOR versions (but not on PATCH versions).**
|
36
|
+
|
35
37
|
## Install
|
36
38
|
|
37
39
|
```
|
@@ -116,6 +118,8 @@ method_1
|
|
116
118
|
|
117
119
|
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/klaxit/micro_bench/tags).
|
118
120
|
|
121
|
+
While still in beta (before `1.0.0`), API may be subject to breaking changes on MINOR versions (but not on PATCH versions).
|
122
|
+
|
119
123
|
## Authors
|
120
124
|
|
121
125
|
See the list of [contributors](https://github.com/klaxit/micro_bench/contributors) who participated in this project.
|
data/lib/micro_bench/version.rb
CHANGED
data/lib/micro_bench.rb
CHANGED
@@ -73,7 +73,7 @@ module MicroBench
|
|
73
73
|
caller_location = caller_locations(2..4).detect do |loc|
|
74
74
|
!loc.absolute_path.include?(__FILE__)
|
75
75
|
end
|
76
|
-
"#{caller_location.absolute_path}:#{caller_location.
|
76
|
+
"#{caller_location.absolute_path}:#{caller_location.base_label}"
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -90,4 +90,24 @@ describe MicroBench do
|
|
90
90
|
expect(subject.method_1_duration).to_not eq(subject.method_2_duration)
|
91
91
|
end
|
92
92
|
|
93
|
+
it "allows referencing a benchmark from a Proc / Block / Lambda" do
|
94
|
+
MicroBench.start
|
95
|
+
# from a Proc
|
96
|
+
proc = Proc.new do
|
97
|
+
expect(MicroBench.duration).to_not be_nil
|
98
|
+
end
|
99
|
+
proc.call
|
100
|
+
# from a Block
|
101
|
+
def my_method
|
102
|
+
yield
|
103
|
+
end
|
104
|
+
my_method do
|
105
|
+
expect(MicroBench.duration).to_not be_nil
|
106
|
+
end
|
107
|
+
# from a Lambda
|
108
|
+
l = lambda do
|
109
|
+
expect(MicroBench.duration).to_not be_nil
|
110
|
+
end
|
111
|
+
l.call
|
112
|
+
end
|
93
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micro_bench
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyrille Courtière
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|