Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32220

Re: method micro benachmarking with reflection

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 <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: method micro benachmarking with reflection
Date Thu, 30 Jul 2015 18:18:11 -0400
Organization A noiseless patient Spider
Lines 36
Message-ID <mpe7oa$nem$1@dont-email.me> (permalink)
References <7c2ab94b-ee4e-41c9-ae71-3896210e80b7@googlegroups.com> <mpd4tj$4aq$1@dont-email.me> <mpe57q$9pf$1@Gaia.teknon.de>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 30 Jul 2015 22:16:42 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="24022"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX187CmBichQhvl1P+wt3lQ2b"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0
In-Reply-To <mpe57q$9pf$1@Gaia.teknon.de>
Cancel-Lock sha1:DZ29bj4EFPtulv04XsYznXZsHDU=
Xref csiph.com comp.lang.java.programmer:32220

Show key headers only | View raw


On 7/30/2015 5:33 PM, Volker Borchert wrote:
> Eric Sosman wrote:
>
>> Using JNI, you might be able to access chip-specific
>> low-level cycle counters or some such -- but even then, you'd have to
>> take it on faith that all the cycles between a method's start and end
>> were consumed by the method; what if the garbage collector decided to
>> preempt the method's thread for a few milliseconds?
>
> And what about the cost of going native? Or has that become a myth?

     I don't know what that cost is, nowadays.  However, if used
once at the start and once at the end of each instrumented method
it should add roughly the same overhead to each, inflating each
method's time by about the same amount.  I think it likely that
the other sources of interference already mentioned (JIT and re-JIT,
GC, preemption and migration of threads, ...) present greater hazards
to meaningful measurement.

     Besides: How do you imagine Java's own methods get the time?
 From the source supplied with the JDK:

	public final class System {
	    ...
	    public static native long currentTimeMillis();
	    ...
	    public static native long nanoTime();
	    ...
	}

Of course, the JVM might special-case "its own" native methods,
but still: A trip into the O/S seems difficult to avoid.

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

method micro benachmarking with reflection philipp.kraus.flashpixx@gmail.com - 2015-07-30 03:41 -0700
  Re: method micro benachmarking with reflection Arne Vajhøj <arne@vajhoej.dk> - 2015-07-30 07:16 -0400
    Re: method micro benachmarking with reflection Arne Vajhøj <arne@vajhoej.dk> - 2015-07-30 21:52 -0400
      Re: method micro benachmarking with reflection Arne Vajhøj <arne@vajhoej.dk> - 2015-07-30 21:55 -0400
  Re: method micro benachmarking with reflection Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-30 08:23 -0400
    Re: method micro benachmarking with reflection e.d.programmer@gmail.com - 2015-07-30 06:00 -0700
      Re: method micro benachmarking with reflection Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-30 09:30 -0400
        Re: method micro benachmarking with reflection e.d.programmer@gmail.com - 2015-07-30 08:26 -0700
          Re: method micro benachmarking with reflection Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-30 11:42 -0400
            Re: method micro benachmarking with reflection e.d.programmer@gmail.com - 2015-07-30 10:30 -0700
              Re: method micro benachmarking with reflection Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-30 14:20 -0400
        Re: method micro benachmarking with reflection Jeff Higgins <jeff@invalid.invalid> - 2015-07-30 16:08 -0400
    Re: method micro benachmarking with reflection philipp.kraus.flashpixx@gmail.com - 2015-07-30 06:11 -0700
    Re: method micro benachmarking with reflection v_borchert@despammed.com (Volker Borchert) - 2015-07-30 21:33 +0000
      Re: method micro benachmarking with reflection Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-30 18:18 -0400
        Re: method micro benachmarking with reflection Arne Vajhøj <arne@vajhoej.dk> - 2015-07-30 20:13 -0400
  Re: method micro benachmarking with reflection Jeff Higgins <jeff@invalid.invalid> - 2015-07-30 17:11 -0400
  Re: method micro benachmarking with reflection v_borchert@despammed.com (Volker Borchert) - 2015-07-30 21:53 +0000
  Re: method micro benachmarking with reflection Sebastian <news@seyweiler.dyndns.org> - 2015-08-04 21:44 +0200

csiph-web