From: Rodrigo Rosenfeld Rosas Date: 2012-03-09T06:27:38+09:00 Subject: [ruby-core:43142] Questions about thread performance (with benchmark included) This is a multi-part message in MIME format. --------------010204060503070105070506 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit A while ago I've written an article entitled "How Nokogiri and JRuby saved my week": http://rosenfeld.herokuapp.com/en/articles/ruby-rails/2012-03-04-how-nokogiri-and-jruby-saved-my-week But I didn't have time to investigate why it was so much faster in JRuby when I wrote it. So, today I decided to investigate this a bit more and prepared a single application that will benchmark the performance of parsing an HTML with Nokogiri using a pool of threads: https://gist.github.com/2003503 If you change the threads pool size to 1, both will perform about the same, but with 10 threads they'll perform quite differently in my computer. Could someone explain me why does it happen? By the way, I'm missing an API for Ruby like the Executors framework for Java: http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/ExecutorService.html Is there something like this in Ruby that I'm not aware of? Thanks in advance, Rodrigo. P.S.: sorry if that is the wrong list to post this benchmark. Let me know if I should post it to Ruby-talk instead. --------------010204060503070105070506 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit A while ago I've written an article entitled "How Nokogiri and JRuby saved my week":

http://rosenfeld.herokuapp.com/en/articles/ruby-rails/2012-03-04-how-nokogiri-and-jruby-saved-my-week

But I didn't have time to investigate why it was so much faster in JRuby when I wrote it. So, today I decided to investigate this a bit more and prepared a single application that will benchmark the performance of parsing an HTML with Nokogiri using a pool of threads:

https://gist.github.com/2003503

If you change the threads pool size to 1, both will perform about the same, but with 10 threads they'll perform quite differently in my computer.

Could someone explain me why does it happen?


By the way, I'm missing an API for Ruby like the Executors framework for Java:

http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/ExecutorService.html

Is there something like this in Ruby that I'm not aware of?

Thanks in advance,
Rodrigo.

P.S.: sorry if that is the wrong list to post this benchmark. Let me know if I should post it to Ruby-talk instead.
--------------010204060503070105070506--