Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: method micro benachmarking with reflection Date: Thu, 30 Jul 2015 11:42:12 -0400 Organization: A noiseless patient Spider Lines: 22 Message-ID: References: <7c2ab94b-ee4e-41c9-ae71-3896210e80b7@googlegroups.com> <72344bf7-bb09-45b2-9e7f-723576fbb639@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 30 Jul 2015 15:40:42 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="18354"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18j00RQZdM5IovvxC5YKlZt" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: Cancel-Lock: sha1:nDh1v3rDx8b0jVX/5dxTHVGuOXM= Xref: csiph.com comp.lang.java.programmer:32213 On 7/30/2015 11:26 AM, e.d.programmer@gmail.com wrote: > On Thursday, July 30, 2015 at 9:30:40 AM UTC-4, Eric Sosman wrote: >> It's much harder for Java, *much* harder. One GC per thousand calls >> might be irrelevant (I'm not confident it is, but won't try to argue), >> but what about one JIT per thousand calls? That is, if the first five >> hundred calls are interpreted and the next five hundred run as native >> code, what happens to the timing? And if the code is then re-JITted >> (as it may be, and frequently is), resulting in a different native-code >> translation, what can one say about the five hundred calls not yet >> measured? > > I haven't tried this microediting myself, I just get the timestamp then run a loop to call the method 10000 times then get the timestamp again and compare. > Normally if it does call a GC at some point you do want that in your performance test because you don't want to test the method in a vacuum, you want to see how long it takes for end users.. One of the articles I linked to suggests doing "several" times that many loop executions ... ... in the *warmup* phase, before serious measurements. -- esosman@comcast-dot-net.invalid "Don't be afraid of work. Make work afraid of you." -- TLM