Project

General

Profile

Feature #15281

Updated by RGBD (Oleg Zubchenko) about 6 years ago

Current implementation computes set intersection s1 & s2 in O(s1.size) time. 
 It can be reduced to O([s1.size, s2.size].min) time. 

 Additional speedup comes from using #each instead of #do_with_enum. 

 See files attached for benchmarks. 

 [Pull Request](https://github.com/ruby/ruby/pull/2003) 

 P.S. using benchmark-ips gem

Back