[#44036] [ruby-trunk - Feature #6242][Open] Ruby should support lists — "shugo (Shugo Maeda)" <redmine@...>

20 messages 2012/04/01

[#44084] [ruby-trunk - Bug #6246][Open] 1.9.3-p125 intermittent segfault — "jshow (Jodi Showers)" <jodi@...>

22 messages 2012/04/02

[#44156] [ruby-trunk - Feature #6265][Open] Remove 'useless' 'concatenation' syntax — "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@...>

45 messages 2012/04/06

[#44163] [ruby-trunk - Bug #6266][Open] encoding related exception with recent integrated psych — "jonforums (Jon Forums)" <redmine@...>

10 messages 2012/04/06

[#44303] [ruby-trunk - Feature #6284][Open] Add composition for procs — "pabloh (Pablo Herrero)" <pablodherrero@...>

57 messages 2012/04/12

[#44349] [ruby-trunk - Feature #6293][Open] new queue / blocking queues — "tenderlovemaking (Aaron Patterson)" <aaron@...>

10 messages 2012/04/13

[#44402] [ruby-trunk - Feature #6308][Open] Eliminate delegation from WeakRef — "headius (Charles Nutter)" <headius@...>

20 messages 2012/04/17

[#44403] [ruby-trunk - Feature #6309][Open] Add a reference queue for weak references — "headius (Charles Nutter)" <headius@...>

15 messages 2012/04/17

[#44533] [ruby-trunk - Bug #6341][Open] SIGSEGV: Thread.new { fork { GC.start } }.join — "rudolf (r stu3)" <redmine@...>

24 messages 2012/04/22

[#44630] [ruby-trunk - Feature #6361][Open] Bitwise string operations — "MartinBosslet (Martin Bosslet)" <Martin.Bosslet@...>

31 messages 2012/04/26

[#44648] [ruby-trunk - Feature #6367][Open] #same? for Enumerable — "prijutme4ty (Ilya Vorontsov)" <prijutme4ty@...>

16 messages 2012/04/26

[#44704] [ruby-trunk - Feature #6373][Open] public #self — "trans (Thomas Sawyer)" <transfire@...>

61 messages 2012/04/27

[#44748] [ruby-trunk - Feature #6376][Open] Feature lookup and checking if feature is loaded — "trans (Thomas Sawyer)" <transfire@...>

13 messages 2012/04/28

[ruby-core:44107] [ruby-trunk - Bug #6250][Rejected] Enumerator::Lazy performance increased

From: "mame (Yusuke Endoh)" <mame@...>
Date: 2012-04-03 09:36:47 UTC
List: ruby-core #44107
Issue #6250 has been updated by mame (Yusuke Endoh).

Status changed from Open to Rejected

#6183 is reopened now.  Please discuss it in that ticket.  Thanks,

-- 
Yusuke Endoh <[email protected]>
----------------------------------------
Bug #6250: Enumerator::Lazy performance increased
https://bugs.ruby-lang.org/issues/6250#change-25635

Author: gregolsen (Innokenty Mikhailov)
Status: Rejected
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0dev (2012-04-03 trunk 35220) [x86_64-linux]


=begin
I'm terribly sorry but it seems that I can't reopen existing issue (https://bugs.ruby-lang.org/issues/6183), so here's the new one:

Finally come up with a concrete idea how to "fix" lazy enumerator performance (based on my first PR https://github.com/ruby/ruby/pull/100).

The idea is to keep all blocks (passed with lazy methods like map or select) as Proc objects inside the enumerator and apply them one by one when value requested (to_a, next, etc) This strategy avoids enumerator chaining on each lazy method call and eliminates fair amount of 'calling the block' with rb_block_call operations. Here's benchmark results:

 2.0.0| ~/projects/ruby(trunk)$ rvm ruby-head
 2.0.0| ~/projects/ruby(trunk)$ ruby bench.rb 
 user     system      total        real
 Lazy enumerator   1.460000   0.000000   1.460000 (  1.465739)
 Simple array      0.420000   0.000000   0.420000 (  0.421446)
 0.287671        NaN        NaN (  0.287531)
 2.0.0| ~/projects/ruby(trunk)$ rvm system
 2.0.0| ~/projects/ruby(trunk)$ ruby bench.rb 
 user     system      total        real
 Lazy enumerator   0.770000   0.000000   0.770000 (  0.764750)
 Simple array      0.370000   0.000000   0.370000 (  0.382653)
 0.480519        NaN        NaN (  0.500364)
 
ruby-head is current trunk compiled, and system ruby - is the same trunk but with my patch applied.
Last row in results is ratio between 'Simple array' time and 'Lazy Enumerator' time.

So, as you can see, with this patch lazy enumerator becomes almost 2 times faster.

It's a 'proof of concept' patch (only map and select added) - let me know if it makes sense. I believe that using this approach and with your help lazy enumerator performance can be improved significantly.

I'm attaching the diff along with the main part of the source code just in case it's hard to follow the diff.

Thanks.
=end



-- 
http://bugs.ruby-lang.org/

In This Thread