GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — `dup`ing an Identity Hash/Set is faster than creating a new one · Issue #230 · fastruby/fast-ruby Open DescriptionIt's one less allocation, too :)
S = Set.new.compare_by_identity.freeze H = Hash.new.compare_by_identity.freeze Benchmark.ips do |x| x.config(time: 10) x.report(".new.compare_by_identity") do |times| i = 0 while (i += 1) <= times S.dup end end x.report(".dup ") do |times| i = 0 while (i += 1) <= times Set.new.compare_by_identity end end x.compare! end Benchmark.ips do |x| x.config(time: 10) x.report(".new.compare_by_identity") do |times| i = 0 while (i += 1) <= times H.dup end end x.report(".dup ") do |times| i = 0 while (i += 1) <= times Hash.new.compare_by_identity end end x.compare! end Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |