benchmark_g_c 1.0.1 → 1.0.2
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 +22 -20
- data/benchmark_g_c.gemspec +1 -1
- data/lib/benchmark_g_c.rb +3 -2
- data/lib/benchmark_g_c/version.rb +1 -1
- 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: 6a59d6f59ec9b87756e23483ac227e27c9d94dbb
|
4
|
+
data.tar.gz: d57f583f194dac07ee8f85aa4fb46741061d2700
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e7d7ba4ad5c638e828fa413e7243b799bb1159573503fd2772975c03f59b6e43b733555c6833f7ece7d049b11a73725fba5d1af695ace7fc0e683d0649fb959
|
7
|
+
data.tar.gz: 9a943a819b2cd47e8d2eb55302cabb544917a4f134dfd8054e4c30ecfd3cb21df79ad4c8a4e207b56285b9486b1e5ca54876e558c3e82859d4835b90bd6cbf4c
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# BenchmarkGC
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
A lightweight gem for benchmarking garbage collect stats relevant to memory optimization.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,39 +20,43 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
23
|
+
```ruby
|
25
24
|
class Thing
|
26
25
|
include BenchmarkGC
|
27
26
|
|
27
|
+
# A method you want to benchmark
|
28
28
|
def method_name
|
29
29
|
do_some_stuff
|
30
30
|
end
|
31
|
+
|
32
|
+
# Add this method in order to benchmark (name doesn't matter)
|
33
|
+
def check
|
34
|
+
bcheck { method_name }
|
35
|
+
end
|
31
36
|
end
|
37
|
+
```
|
38
|
+
|
39
|
+
In a console:
|
32
40
|
|
33
|
-
|
41
|
+
```ruby
|
42
|
+
Thing.new.check
|
43
|
+
```
|
34
44
|
|
35
|
-
Parameter options (all are optional):
|
36
|
-
|
37
|
-
|
38
|
-
|
45
|
+
#### Parameter options (all are optional):
|
46
|
+
* **name**: *(string)* Print the name of the benchmarked code
|
47
|
+
* **times**: *(integer)* Number of times to run the benchmarked code in succession
|
48
|
+
* **logger**: *(boolean)* `ActiveRecord::Base.logger` should log
|
39
49
|
|
40
|
-
bcheck returns the value of the benchmarked code, making this possible:
|
50
|
+
#### bcheck returns the value of the benchmarked code, making this possible:
|
51
|
+
```ruby
|
41
52
|
class Thing
|
42
53
|
...
|
43
54
|
def method_name
|
44
55
|
bcheck { do_some_stuff }
|
45
56
|
end
|
46
57
|
end
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
51
|
-
|
52
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
53
|
-
|
54
|
-
## Contributing
|
55
|
-
|
56
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/benchmark_g_c.
|
57
|
-
|
58
|
+
```
|
59
|
+
Now you can run any code that uses method_name, and method_name will get benchmarked each time it is run.
|
58
60
|
|
59
61
|
## License
|
60
62
|
|
data/benchmark_g_c.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["jnicholasjacques@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Benchmark Garbage Collect stats relevant to memory optimization.}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/jacquesn/benchmark_g_c"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
data/lib/benchmark_g_c.rb
CHANGED
@@ -26,8 +26,9 @@ module BenchmarkGC
|
|
26
26
|
name = options[:name]
|
27
27
|
times = options[:times]
|
28
28
|
logger = options[:logger]
|
29
|
-
|
30
|
-
|
29
|
+
if defined? Rails.env
|
30
|
+
ActiveRecord::Base.logger = nil unless logger
|
31
|
+
end
|
31
32
|
results = []
|
32
33
|
return_value = nil
|
33
34
|
times.times do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benchmark_g_c
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Jacques
|
@@ -55,7 +55,7 @@ files:
|
|
55
55
|
- bin/setup
|
56
56
|
- lib/benchmark_g_c.rb
|
57
57
|
- lib/benchmark_g_c/version.rb
|
58
|
-
homepage:
|
58
|
+
homepage: https://github.com/jacquesn/benchmark_g_c
|
59
59
|
licenses:
|
60
60
|
- MIT
|
61
61
|
metadata: {}
|