[Ironruby-core] Weird performance problem with "find"

Michael Letterle michael.letterle at gmail.com
Wed Feb 6 15:23:10 EST 2008


He's right about the issue however:

find took: 00:00:00.0081136
find took: 00:00:00.0022516
find took: 00:00:00.0021312

[snip]

find took: 00:00:00.0220530
find took: 00:00:00.0245721
find took: 00:00:00.0238102

[snip]

find took: 00:00:00.0377458
find took: 00:00:00.0453373
find took: 00:00:00.0369415

On Feb 6, 2008 3:13 PM, M. David Peterson <m.david at xmlhacker.com> wrote:
> On Wed, 06 Feb 2008 12:38:46 -0700, Eric Nicholson <enicholson at gmail.com>
> wrote:
>
> > require 'mscorlib'
> > require 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll'
> >
> > a = (1..1000).to_a
> > s = System::Diagnostics::Stopwatch.new()
> >
> > 100.times {
> >     s.start
> >     a.find {|x| x == 1000}
> >     s.stop
> >     puts "find took: #{s.elapsed.ToString}"
> > }
>
>
> You're reusing the same Stopwatch instance, so you have to add a call to
> the Reset method at the end of each iteration.  In doing so you should
> find your timings are as they should be.
>
>
> --
> /M:D
>
> M. David Peterson
> Co-Founder & Chief Architect, 3rd&Urban, LLC
> Email: m.david at 3rdandUrban.com | m.david at amp.fm
> Mobile: (206) 418-9027
> http://3rdandUrban.com | http://amp.fm |
> http://www.oreillynet.com/pub/au/2354
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>



-- 
Michael Letterle
[Polymath Programmer]
http://michaeldotnet.blogspot.com


More information about the Ironruby-core mailing list