Re: Struct is slow
- From: Joel VanderWerf <vjoel@xxxxxxxxxxxxxxxxx>
- Date: Wed, 17 Oct 2007 15:28:33 +0900
Sylvain Joyeux wrote:
I'm not sure whether you are familiar with Benchmark#bmbm which does aSure. GC does belong to the mix. Now, if GC is enabled you are not able to compare anything. Let's assume that GC runs during 'array init', you will say 'hey, struct init is faster'. Now, if GC runs during 'struct init' the result may change ...
rehearsal - personally I rather not switch off GC since in realistic
situations GC time belongs into the mix. But results are rather
similar:
Keeping GC is meaningful when benchmarking a whole application. In microbenchmarks like these, it is simply noise.
For fairness, you could do it this way (assuming REP is large enough):
...
Benchmark.bmbm 15 do |x|
GC.start
x.report 'struct init' do
REP.times { Foo.new data, data }
GC.start
end
GC.start
x.report 'array init' do
REP.times { [data, data] }
GC.start
end
...
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
.
- Follow-Ups:
- Re: Struct is slow
- From: Robert Klemme
- Re: Struct is slow
- References:
- Re: Struct is slow
- From: Robert Klemme
- Re: Struct is slow
- From: Sylvain Joyeux
- Re: Struct is slow
- Prev by Date: Re: how can send email message using ruby?
- Next by Date: Re: How to remove "~" in those files
- Previous by thread: Re: Struct is slow
- Next by thread: Re: Struct is slow
- Index(es):
Relevant Pages
|