The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
New Formatting System: Cooler AND Faster

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Gregory Brown

Posts: 172
Nickname: greg7224
Registered: Nov, 2005

Gregory Brown is the author of Ruby Reports (ruport)
New Formatting System: Cooler AND Faster Posted: Jun 7, 2006 3:36 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Gregory Brown.
Original Post: New Formatting System: Cooler AND Faster
Feed Title: Ruby Reports Blog
Feed URL: http://www.cwinters.com/blog/index.rss
Feed Description: News and Updates regarding the Ruby Reports library and toolset.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Gregory Brown
Latest Posts From Ruby Reports Blog

Advertisement

Even though Zed Shaw will have my head for awful benchmarking like this, it was my suspicion that the new formatting engine would some how be faster than the old one. Afterall, it doesn't bother to check for FasterCSV, it just assumes you have it, the code is cleaner which means it's less likely to be full of spazoidal stuff, and even though it relys more heavily on translating data into arrays, DataSet's new to_a method is much more efficient (thanks to Dudley Flanders).

So my little random shot in the dark script looks like this:

require "ruport"
a = [ [1,2],[3,4],[5,6] ].to_ds(%w[a b])
20000.times { a.as(:csv) }

And yes, it's your typical bad benchmark. Just picked a few random powers of ten until I found a sweet spot.

But take a look at the results:

Old System (0.4.4 includes the new formatting system, but DataSet still uses Format::Builder)

[sandal@harmonix rel_0_4_4]$ time ruby -Ilib -rubygems simple.rb

real    0m11.371s
user    0m11.025s
sys     0m0.324s

New System ( On SVN as of revision 287 )

[sandal@harmonix ruport]$ time ruby -Ilib -rubygems simple.rb

real    0m10.412s
user    0m10.185s
sys     0m0.200s

Whee, ~10% speed gain for free! :)

Read: New Formatting System: Cooler AND Faster

Topic: New maintainer for the spreadsheet package Previous Topic   Next Topic Topic: Upgrade to Intel Version of SSHKeychain

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use