Commit 867ad521f89ba2f0aad9b1f08935963b61ad9290
Exists in
master
and in
29 other branches
Merge branch 'stable'
Showing
1 changed file
with
11 additions
and
7 deletions
Show diff stats
test/integration/performance_test.rb
@@ -22,16 +22,20 @@ class PerformanceTest < ActionController::IntegrationTest | @@ -22,16 +22,20 @@ class PerformanceTest < ActionController::IntegrationTest | ||
22 | should 'not have a linear increase in time to display a blog page' do | 22 | should 'not have a linear increase in time to display a blog page' do |
23 | person = create_profile('clueless') | 23 | person = create_profile('clueless') |
24 | 24 | ||
25 | + person0 = create_profile('person0') | ||
26 | + person1 = create_profile('person1') | ||
27 | + create_posts(person1, 50) | ||
28 | + person2 = create_profile('person2') | ||
29 | + create_posts(person2, 100) | ||
30 | + | ||
25 | # no posts | 31 | # no posts |
26 | - time0 = (Benchmark.measure { get '/clueless/blog' }) | 32 | + time0 = (Benchmark.measure { get '/person0/blog' }) |
27 | 33 | ||
28 | # first 50 | 34 | # first 50 |
29 | - create_posts(person) | ||
30 | - time1 = (Benchmark.measure { get '/clueless/blog' }) | 35 | + time1 = (Benchmark.measure { get '/person1/blog' }) |
31 | 36 | ||
32 | # another 50 | 37 | # another 50 |
33 | - create_posts(person) | ||
34 | - time2 = (Benchmark.measure { get '/clueless/blog' }) | 38 | + time2 = (Benchmark.measure { get '/person2/blog' }) |
35 | 39 | ||
36 | # should not scale linearly, i.e. the inclination of the first segment must | 40 | # should not scale linearly, i.e. the inclination of the first segment must |
37 | # be a lot higher than the one of the segment segment. To compensate for | 41 | # be a lot higher than the one of the segment segment. To compensate for |
@@ -51,10 +55,10 @@ class PerformanceTest < ActionController::IntegrationTest | @@ -51,10 +55,10 @@ class PerformanceTest < ActionController::IntegrationTest | ||
51 | person | 55 | person |
52 | end | 56 | end |
53 | 57 | ||
54 | - def create_posts(profile) | 58 | + def create_posts(profile, n) |
55 | postnumber = profile.articles.count | 59 | postnumber = profile.articles.count |
56 | blog = profile.blog | 60 | blog = profile.blog |
57 | - 50.times do |i| | 61 | + n.times do |i| |
58 | postnumber += 1 | 62 | postnumber += 1 |
59 | TinyMceArticle.create!(:profile => profile, :parent => blog, :name => "post number #{postnumber}") | 63 | TinyMceArticle.create!(:profile => profile, :parent => blog, :name => "post number #{postnumber}") |
60 | end | 64 | end |