memeasure 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -0
- data/lib/{measure.rb → memeasure/measure.rb} +1 -1
- data/lib/memeasure.rb +5 -0
- data/memeasure-0.0.2.gem +0 -0
- data/memeasure.gemspec +15 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea66147c669047a9e552ee39175b0ed96247e614
|
4
|
+
data.tar.gz: ef9958a51e880ca2df4692ba002d79d3d2e0d807
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c4193c13e3efcd18318e3bc9de60e80a93d78c4c096fe38837bc71ab12bd4ba9e63a787893122d9b1e238bc30616c74338c345d7400c5be3b73a49669c8a457
|
7
|
+
data.tar.gz: f4528199903941bbd3ce5e9bf79a4d86cb939b112f701322ccdcc1ab2d0d4af662c3d1b643d23416bca6ec1d494c86754049433faced0c179377f4d1fa76ebae
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
## A Simple Memory Profiler
|
2
|
+
|
3
|
+
Taken directly from **Ruby Performance Optimization**
|
4
|
+
|
5
|
+
### Install Instructions
|
6
|
+
1. include `gem 'memeasure'`
|
7
|
+
2. `bundle install`
|
8
|
+
|
9
|
+
### Usage Instructions
|
10
|
+
|
11
|
+
Say you have the following code:
|
12
|
+
```ruby
|
13
|
+
|
14
|
+
class Person
|
15
|
+
def name
|
16
|
+
1000.times { "x" * 1024 * 1024 * 10 } # A 10 MB string
|
17
|
+
end
|
18
|
+
end
|
19
|
+
```
|
20
|
+
|
21
|
+
And you want to see how much memory it takes to run your Person#name method. You'd simply have to
|
22
|
+
pass your code as a block to `Measure.run`
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
require 'memeasure'
|
26
|
+
|
27
|
+
class Person
|
28
|
+
|
29
|
+
def name
|
30
|
+
Measure.run do
|
31
|
+
1000.times { "x" * 1024 * 1024 * 10 }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
```
|
37
|
+
|
38
|
+
Jumping into a rails/irb console, loading this file, and running `Person.new.name` will generate the output in a similar format to:
|
39
|
+
|
40
|
+
```
|
41
|
+
{"2.2.0": {"gc": "enable", "time": 2.1, "gc_count": 10, "memory": "525 MB"}}
|
42
|
+
```
|
data/lib/memeasure.rb
ADDED
data/memeasure-0.0.2.gem
ADDED
Binary file
|
data/memeasure.gemspec
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$LOAD_PATH << File.expand_path("../lib", __FILE__)
|
2
|
+
require 'memeasure'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'memeasure'
|
6
|
+
s.version = MeMeasure::VERSION
|
7
|
+
s.date = '2015-12-30'
|
8
|
+
s.summary = "Basic ruby memory profiling tool"
|
9
|
+
s.description = "A bare bones memory measurement tool for ruby / rails"
|
10
|
+
s.authors = ["Dain Hall"]
|
11
|
+
s.email = 'dainovu3@gmail.com'
|
12
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
13
|
+
s.homepage = 'http://rubygems.org/gems/memeasure'
|
14
|
+
s.license = 'MIT'
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memeasure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dain Hall
|
@@ -16,7 +16,11 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
-
-
|
19
|
+
- README.md
|
20
|
+
- lib/memeasure.rb
|
21
|
+
- lib/memeasure/measure.rb
|
22
|
+
- memeasure-0.0.2.gem
|
23
|
+
- memeasure.gemspec
|
20
24
|
homepage: http://rubygems.org/gems/memeasure
|
21
25
|
licenses:
|
22
26
|
- MIT
|