refuse 0.0.1 → 0.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.
- data/README.textile +22 -2
- data/lib/refuse/cucumber.rb +7 -0
- data/lib/refuse/version.rb +1 -1
- data/refuse.gemspec +1 -1
- metadata +5 -17
data/README.textile
CHANGED
@@ -2,11 +2,27 @@ h1. Defer garbage collection to speed up your tests.
|
|
2
2
|
|
3
3
|
Spurned on by a burgeoning test suite, and inspired by "Crank Your Specs":http://blog.carbonfive.com/2011/02/02/crank-your-specs/ and "The road to faster tests":http://37signals.com/svn/posts/2742-the-road-to-faster-tests, I've wrapped up the garbage collection hack to make it easy to reuse.
|
4
4
|
|
5
|
+
It's a bit of a bandaid solution for now, but it gets the job done.
|
6
|
+
|
7
|
+
Here's the gist of what Refuse does: clears up some memory leaks by releasing instance variables and defers garbage collection.
|
8
|
+
|
9
|
+
Garbage collection is a blocking call, so the more objects you have, the more it wants to run. The more it wants to run, the less your code will run.
|
10
|
+
|
11
|
+
So, yes, the caveat is that the memory footprint of your test suite will increase, but can often speed up your tests by 40% or more on Ruby 1.8 and Ruby 1.9.
|
12
|
+
|
13
|
+
If you're running REE, you might want to take a look at tweaking the GC settings seen in "Grease Your Suite":http://grease-your-suite.heroku.com/#85:
|
14
|
+
|
15
|
+
<pre>export RUBY_HEAP_MIN_SLOTS=1000000
|
16
|
+
export RUBY_HEAP_SLOTS_INCREMENT=1000000
|
17
|
+
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
|
18
|
+
export RUBY_GC_MALLOC_LIMIT=1000000000
|
19
|
+
export RUBY_HEAP_FREE_MIN=500000</pre>
|
20
|
+
|
5
21
|
h2. Usage
|
6
22
|
|
7
23
|
h3. Rspec
|
8
24
|
|
9
|
-
|
25
|
+
In your @spec_helper.rb@:
|
10
26
|
|
11
27
|
<pre>config.before(:each) do
|
12
28
|
Refuse.disable
|
@@ -20,6 +36,10 @@ h3. Cucumber
|
|
20
36
|
|
21
37
|
In @env.rb@:
|
22
38
|
|
39
|
+
<pre>require 'refuse/cucumber'</pre>
|
40
|
+
|
41
|
+
Or if you want,
|
42
|
+
|
23
43
|
<pre>Before do
|
24
44
|
Refuse.disable
|
25
45
|
end
|
@@ -30,4 +50,4 @@ end</pre>
|
|
30
50
|
|
31
51
|
h3. Test::Unit
|
32
52
|
|
33
|
-
|
53
|
+
Fork this and send me a pull request please.
|
data/lib/refuse/version.rb
CHANGED
data/refuse.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Brian Ryckbost"]
|
10
10
|
s.email = ["brian@collectiveidea.com"]
|
11
|
-
s.homepage = "http://
|
11
|
+
s.homepage = "http://github.com/collectiveidea/refuse.git"
|
12
12
|
s.summary = %q{Defer garbage collection}
|
13
13
|
s.description = %q{Wrap up some common functionality of deferring garbage collection. Often used to speed up test suites by 40%-60%.}
|
14
14
|
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refuse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 29
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
5
|
+
version: 0.0.2
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Brian Ryckbost
|
@@ -15,8 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
13
|
+
date: 2011-06-01 00:00:00 Z
|
20
14
|
dependencies: []
|
21
15
|
|
22
16
|
description: Wrap up some common functionality of deferring garbage collection. Often used to speed up test suites by 40%-60%.
|
@@ -34,10 +28,10 @@ files:
|
|
34
28
|
- README.textile
|
35
29
|
- Rakefile
|
36
30
|
- lib/refuse.rb
|
31
|
+
- lib/refuse/cucumber.rb
|
37
32
|
- lib/refuse/version.rb
|
38
33
|
- refuse.gemspec
|
39
|
-
|
40
|
-
homepage: http://ryckbost.com
|
34
|
+
homepage: http://github.com/collectiveidea/refuse.git
|
41
35
|
licenses: []
|
42
36
|
|
43
37
|
post_install_message:
|
@@ -50,23 +44,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
44
|
requirements:
|
51
45
|
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
hash: 3
|
54
|
-
segments:
|
55
|
-
- 0
|
56
47
|
version: "0"
|
57
48
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
49
|
none: false
|
59
50
|
requirements:
|
60
51
|
- - ">="
|
61
52
|
- !ruby/object:Gem::Version
|
62
|
-
hash: 3
|
63
|
-
segments:
|
64
|
-
- 0
|
65
53
|
version: "0"
|
66
54
|
requirements: []
|
67
55
|
|
68
56
|
rubyforge_project: refuse
|
69
|
-
rubygems_version: 1.
|
57
|
+
rubygems_version: 1.7.2
|
70
58
|
signing_key:
|
71
59
|
specification_version: 3
|
72
60
|
summary: Defer garbage collection
|