I have two implementations of a function, and I’d like to get some statistics about which one is faster. My instinct is to make sure the garbage-collector runs before I start each of them. I.e., I don’t want the cost of garbage collecting implementation-A to be tallied into the computation of implementation-B.
Is that a valid concern? Is there something I should do to make sure I don’t count the GC of implementation-A in the timing code of implementation-B?