Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
alba benchmark
diff --git a/benchmark/local.rb b/benchmark/local.rb
index c5bbe29..f89c742 100644
--- a/benchmark/local.rb
+++ b/benchmark/local.rb
@@ -162,8 +162,10 @@ def commenter_names
post = Post.create!(body: 'post')
user1 = User.create!(name: 'John')
user2 = User.create!(name: 'Jane')
-post.comments.create!(commenter: user1, body: 'Comment1')
-post.comments.create!(commenter: user2, body: 'Comment2')
+100.times do |i|
+ post.comments.create!(commenter: user1, body: "Comment1-#{i}")
+ post.comments.create!(commenter: user2, body: "Comment2-#{i}")
+end
post.reload
alba = Proc.new { AlbaPostResource.new(post).serialize }
$ ruby local.rb 
(...)
Rehearsal -------------------------------------------------
alba            1.994011   0.020097   2.014108 (  2.028281)
jbuilder        1.319729   0.012514   1.332243 (  1.341253)
ams             3.098591   0.026996   3.125587 (  3.156368)
rails           1.565020   0.007578   1.572598 (  1.580336)
blueprinter     2.241927   0.018420   2.260347 (  2.284634)
representable   3.337566   0.088180   3.425746 (  3.443431)
alba_inline     2.937908   0.020395   2.958303 (  2.982212)
--------------------------------------- total: 16.688932sec

                    user     system      total        real
alba            2.048219   0.011897   2.060116 (  2.073666)
jbuilder        1.277749   0.006465   1.284214 (  1.290332)
ams             3.130986   0.019952   3.150938 (  3.182356)
rails           1.562357   0.011378   1.573735 (  1.588288)
blueprinter     2.232424   0.016438   2.248862 (  2.270647)
representable   3.163082   0.056906   3.219988 (  3.245553)
alba_inline     2.775239   0.017082   2.792321 (  2.815097)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment