|
8 | 8 | before(:all) { GC.disable } |
9 | 9 | after(:all) { GC.enable } |
10 | 10 |
|
11 | | -# context 'when testing performance of serialization' do |
12 | | -# it 'should create a hash of 1000 records in less than 50 ms' do |
13 | | -# movies = 1000.times.map { |_i| movie } |
14 | | -# expect { MovieSerializer.new(movies).serializable_hash }.to perform_under(50).ms |
15 | | -# end |
16 | | -# |
17 | | -# it 'should serialize 1000 records to jsonapi in less than 60 ms' do |
18 | | -# movies = 1000.times.map { |_i| movie } |
19 | | -# expect { MovieSerializer.new(movies).serialized_json }.to perform_under(60).ms |
20 | | -# end |
21 | | -# |
22 | | -# it 'should create a hash of 1000 records with includes and meta in less than 75 ms' do |
23 | | -# count = 1000 |
24 | | -# movies = count.times.map { |_i| movie } |
25 | | -# options = {} |
26 | | -# options[:meta] = { total: count } |
27 | | -# options[:include] = [:actors] |
28 | | -# expect { MovieSerializer.new(movies, options).serializable_hash }.to perform_under(75).ms |
29 | | -# end |
30 | | -# |
31 | | -# it 'should serialize 1000 records to jsonapi with includes and meta in less than 75 ms' do |
32 | | -# count = 1000 |
33 | | -# movies = count.times.map { |_i| movie } |
34 | | -# options = {} |
35 | | -# options[:meta] = { total: count } |
36 | | -# options[:include] = [:actors] |
37 | | -# expect { MovieSerializer.new(movies, options).serialized_json }.to perform_under(75).ms |
38 | | -# end |
39 | | -# end |
| 11 | + context 'when testing performance of serialization' do |
| 12 | + it 'should create a hash of 1000 records in less than 50 ms' do |
| 13 | + movies = 1000.times.map { |_i| movie } |
| 14 | + expect { MovieSerializer.new(movies).serializable_hash }.to perform_under(50).ms |
| 15 | + end |
| 16 | + |
| 17 | + it 'should serialize 1000 records to jsonapi in less than 60 ms' do |
| 18 | + movies = 1000.times.map { |_i| movie } |
| 19 | + expect { MovieSerializer.new(movies).serialized_json }.to perform_under(60).ms |
| 20 | + end |
| 21 | + |
| 22 | + it 'should create a hash of 1000 records with includes and meta in less than 75 ms' do |
| 23 | + count = 1000 |
| 24 | + movies = count.times.map { |_i| movie } |
| 25 | + options = {} |
| 26 | + options[:meta] = { total: count } |
| 27 | + options[:include] = [:actors] |
| 28 | + expect { MovieSerializer.new(movies, options).serializable_hash }.to perform_under(75).ms |
| 29 | + end |
| 30 | + |
| 31 | + it 'should serialize 1000 records to jsonapi with includes and meta in less than 75 ms' do |
| 32 | + count = 1000 |
| 33 | + movies = count.times.map { |_i| movie } |
| 34 | + options = {} |
| 35 | + options[:meta] = { total: count } |
| 36 | + options[:include] = [:actors] |
| 37 | + expect { MovieSerializer.new(movies, options).serialized_json }.to perform_under(75).ms |
| 38 | + end |
| 39 | + end |
40 | 40 |
|
41 | 41 | def print_stats(message, count, ams_time, jsonapi_time, our_time) |
42 | 42 | format = '%-15s %-10s %s' |
|
0 commit comments