Rate counter: Difference between revisions

Content added Content deleted
Line 1,777: Line 1,777:
x.report('array'){searchlist.each{|el| documents_a.any?{|d| d.id == el}} }
x.report('array'){searchlist.each{|el| documents_a.any?{|d| d.id == el}} }
x.report('hash'){searchlist.each{|el| documents_h.has_key?(el)} }
x.report('hash'){searchlist.each{|el| documents_h.has_key?(el)} }
end
end</lang>

</lang>
System: I7-6700HQ, 3.5 GHz, Linux Kernel 5.6.17, Ruby 2.7.1
Run as: $ crystal run longprimes.cr --release
{{Output}}
{{Output}}
<pre>
<pre>
user system total real
user system total real
array 41.660000 0.000000 41.660000 ( 41.692570)
array 0.308848 0.037154 0.346002 ( 0.158290)
hash 0.020000 0.000000 0.020000 ( 0.013756)
hash 0.005239 0.001036 0.006275 ( 0.002252)
➜ rosettacode

</pre>
</pre>