small medium large xlarge

29 Dec 2015, 17:54
Radoslaw Bulat (4 posts)

I have a problem with verifying table on page 30. IMHO presenting such a data without giving an exact methodology is not a good idea. There should be provided a ruby script which collected this data. Based on chp2/iterator_each1.rb and chp2/iterator_each2.rb examples I wrote one:

I attached results for ruby 2.1.5, 2.2.4 and 2.3.0. As you can see none of them are in line with results from the table and what is more interesting ruby 2.3.0 doesn’t create T_NODE objects for any of tested methods. It means they were optimized or this methodology is wrong for 2.3.0.

I also don’t know what ‘-‘ (dash) in the table mean. It can’t mean that method doesn’t exist in given class because for example fill method exists in Array class. Maybe Enum and Array was exchanged by mistake?

08 Jan 2016, 14:33
Alexander Dymo (9 posts)

You can find the script I used in code/chp2/iterator_investigation.rb.

But you are correct that table header is wrong! The columns are really Array, Range, and Hash. Huge thanks for finding this bug!

PS: yes, the script reports no T_NODE creation in Ruby 2.3. I’m yet to to look at the source to see whether that is a real optimization or not.

You must be logged in to comment