rails-perftest 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -1
- data/README.md +10 -91
- data/lib/rails/perftest/active_support/testing/performance/ruby.rb +0 -6
- data/lib/rails/perftest/railties/testing.tasks +3 -3
- data/lib/rails/perftest/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1a331fe4a507a23d20bf3a94ca15b746c9e34c8
|
4
|
+
data.tar.gz: bf3817a01f370865b84f3cce503d330df8c5e559
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3422c1ef78ee8ebaffa265dae938aeea16b2e7b8b0216ff2ef33b469817c3adcf4d169fb39da89d7bb18015883c17e2440e58cd92bb1f414d9438ef8c8fb4ab6
|
7
|
+
data.tar.gz: 65f1764b8e2c269f25953d38b06b3a3933b5f21e00f9e69637c25db47d9b927198eab6d4d98ff9d72bb0d12831cf0f5a114f63bfcf0f0ccaca2bf1d67bde311b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -141,8 +141,8 @@ class PostPerformanceTest < ActionDispatch::PerformanceTest
|
|
141
141
|
end
|
142
142
|
```
|
143
143
|
|
144
|
-
You can find more details about the `get` and `post` methods in the
|
145
|
-
[Testing Rails Applications](testing.html) guide.
|
144
|
+
You can find more details about the `get` and `post` methods in the
|
145
|
+
[Testing Rails Applications](http://guides.rubyonrails.org/testing.html) guide.
|
146
146
|
|
147
147
|
#### Model Example
|
148
148
|
|
@@ -183,6 +183,11 @@ To run performance tests in benchmarking mode:
|
|
183
183
|
$ rake test:benchmark
|
184
184
|
```
|
185
185
|
|
186
|
+
To run a single test pass it as TEST:
|
187
|
+
```bash
|
188
|
+
$ bin/rake test:benchmark TEST=test/performance/your_test.rb
|
189
|
+
```
|
190
|
+
|
186
191
|
#### Profiling
|
187
192
|
|
188
193
|
Profiling allows you to make an in-depth analysis of each of your tests by using
|
@@ -417,95 +422,9 @@ Rails.logger.level = ActiveSupport::Logger::INFO
|
|
417
422
|
As `ActionController::Base.perform_caching` is set to `true`, performance tests
|
418
423
|
will behave much as they do in the `production` environment.
|
419
424
|
|
420
|
-
### Installing GC-Patched MRI
|
421
|
-
|
422
|
-
To get the best from Rails' performance tests under MRI, you'll need to build
|
423
|
-
a special Ruby binary with some super powers.
|
424
|
-
|
425
|
-
The recommended patches for each MRI version are:
|
426
|
-
|
427
|
-
| Version | Patch |
|
428
|
-
| --------------- | --------- |
|
429
|
-
| 1.8.6 | ruby186gc |
|
430
|
-
| 1.8.7 | ruby187gc |
|
431
|
-
| 1.9.2 and above | gcdata |
|
432
|
-
|
433
|
-
All of these can be found on [RVM's _patches_ directory](https://github.com/wayneeseguin/rvm/tree/master/patches/ruby)
|
434
|
-
under each specific interpreter version.
|
435
|
-
|
436
|
-
Concerning the installation itself, you can either do this easily by using
|
437
|
-
[RVM](https://rvm.io/) or you can build everything from source,
|
438
|
-
which is a little bit harder.
|
439
|
-
|
440
|
-
#### Install Using RVM
|
441
|
-
|
442
|
-
The process of installing a patched Ruby interpreter is very easy if you let RVM
|
443
|
-
do the hard work. All of the following RVM commands will provide you with a
|
444
|
-
patched Ruby interpreter:
|
445
|
-
|
446
|
-
```bash
|
447
|
-
$ rvm install 1.9.2-p180 --patch gcdata
|
448
|
-
$ rvm install 1.8.7 --patch ruby187gc
|
449
|
-
$ rvm install 1.9.2-p180 --patch ~/Downloads/downloaded_gcdata_patch.patch
|
450
|
-
```
|
451
|
-
|
452
|
-
You can even keep your regular interpreter by assigning a name to the patched
|
453
|
-
one:
|
454
|
-
|
455
|
-
```bash
|
456
|
-
$ rvm install 1.9.2-p180 --patch gcdata --name gcdata
|
457
|
-
$ rvm use 1.9.2-p180 # your regular ruby
|
458
|
-
$ rvm use 1.9.2-p180-gcdata # your patched ruby
|
459
|
-
```
|
460
|
-
|
461
|
-
And it's done! You have installed a patched Ruby interpreter.
|
462
|
-
|
463
|
-
#### Install From Source
|
464
|
-
|
465
|
-
This process is a bit more complicated, but straightforward nonetheless. If
|
466
|
-
you've never compiled a Ruby binary before, follow these steps to build a
|
467
|
-
Ruby binary inside your home directory.
|
468
|
-
|
469
|
-
##### Download and Extract
|
470
|
-
|
471
|
-
```bash
|
472
|
-
$ mkdir rubygc
|
473
|
-
$ wget <the version you want from ftp://ftp.ruby-lang.org/pub/ruby>
|
474
|
-
$ tar -xzvf <ruby-version.tar.gz>
|
475
|
-
$ cd <ruby-version>
|
476
|
-
```
|
477
|
-
|
478
|
-
##### Apply the Patch
|
479
|
-
|
480
|
-
```bash
|
481
|
-
$ curl http://github.com/wayneeseguin/rvm/raw/master/patches/ruby/1.9.2/p180/gcdata.patch | patch -p0 # if you're on 1.9.2!
|
482
|
-
$ curl http://github.com/wayneeseguin/rvm/raw/master/patches/ruby/1.8.7/ruby187gc.patch | patch -p0 # if you're on 1.8.7!
|
483
|
-
```
|
484
|
-
|
485
|
-
##### Configure and Install
|
486
|
-
|
487
|
-
The following will install Ruby in your home directory's `/rubygc` directory.
|
488
|
-
Make sure to replace `<homedir>` with a full patch to your actual home
|
489
|
-
directory.
|
490
|
-
|
491
|
-
```bash
|
492
|
-
$ ./configure --prefix=/<homedir>/rubygc
|
493
|
-
$ make && make install
|
494
|
-
```
|
495
|
-
|
496
|
-
##### Prepare Aliases
|
497
|
-
|
498
|
-
For convenience, add the following lines in your `~/.profile`:
|
499
|
-
|
500
|
-
```bash
|
501
|
-
alias gcruby='~/rubygc/bin/ruby'
|
502
|
-
alias gcrake='~/rubygc/bin/rake'
|
503
|
-
alias gcgem='~/rubygc/bin/gem'
|
504
|
-
alias gcirb='~/rubygc/bin/irb'
|
505
|
-
alias gcrails='~/rubygc/bin/rails'
|
506
|
-
```
|
425
|
+
### Installing GC-Patched MRI 1.x.x
|
507
426
|
|
508
|
-
|
427
|
+
Since Ruby 2 is now mainstream and handles garbage collection issues these docs have been cut. [View older readme explaning how to install optimized Ruby 1 builds](https://github.com/rails/rails-perftest/blob/2d4bbd6206f86a3bbe38ed825dddbf555ffdce41/README.md#installing-gc-patched-mri).
|
509
428
|
|
510
429
|
Command Line Tools
|
511
430
|
------------------
|
@@ -603,7 +522,7 @@ NOTE: `benchmark` is a class method inside controllers.
|
|
603
522
|
|
604
523
|
### View
|
605
524
|
|
606
|
-
And in [views](http://api.rubyonrails.org/classes/ActiveSupport/Benchmarkable.html
|
525
|
+
And in [views](http://api.rubyonrails.org/classes/ActiveSupport/Benchmarkable.html)
|
607
526
|
|
608
527
|
```erb
|
609
528
|
<% benchmark("Showing projects partial") do %>
|
@@ -119,12 +119,6 @@ module ActiveSupport
|
|
119
119
|
class CpuTime < Time
|
120
120
|
Mode = RubyProf::CPU_TIME if RubyProf.const_defined?(:CPU_TIME)
|
121
121
|
|
122
|
-
def initialize(*args)
|
123
|
-
# FIXME: yeah my CPU is 2.33 GHz
|
124
|
-
RubyProf.cpu_frequency = 2.33e9 unless RubyProf.cpu_frequency > 0
|
125
|
-
super
|
126
|
-
end
|
127
|
-
|
128
122
|
def measure
|
129
123
|
RubyProf.measure_cpu_time
|
130
124
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
require '
|
1
|
+
require 'rake/testtask'
|
2
2
|
|
3
3
|
namespace :test do
|
4
4
|
task 'perftest:benchmark_mode' do
|
5
5
|
ENV["BENCHMARK_TESTS"] = '1'
|
6
6
|
end
|
7
7
|
|
8
|
-
|
8
|
+
Rake::TestTask.new(benchmark: ['test:prepare', 'test:perftest:benchmark_mode']) do |t|
|
9
9
|
t.libs << 'test'
|
10
10
|
t.pattern = 'test/performance/**/*_test.rb'
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
Rake::TestTask.new(profile: 'test:prepare') do |t|
|
14
14
|
t.libs << 'test'
|
15
15
|
t.pattern = 'test/performance/**/*_test.rb'
|
16
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-perftest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yves Senn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-prof
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
189
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.
|
190
|
+
rubygems_version: 2.5.1
|
191
191
|
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: ActionDispatch::PerformanceTest, ActiveSupport::Testing::Performance extracted
|