Removing intrinsic of Thread.isInterrupted() (original) (raw)
Aleksey Shipilev aleksey.shipilev at oracle.com
Tue Feb 25 00:36:38 PST 2014
- Previous message: Removing intrinsic of Thread.isInterrupted()
- Next message: Removing intrinsic of Thread.isInterrupted()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 02/25/2014 12:31 PM, Florian Weimer wrote:
On 02/25/2014 02:46 AM, Yumin Qi wrote:
isum = 0L; for (int i = 0; i < NUM; i++) { start = System.currentTimeMillis(); t.isInterrupted(); finish = System.currentTimeMillis(); isum += (finish - start); } This benchmark loop looks invalid to me. I think you have to store the result of t.isInterrupted(), perhaps to an array of booleans, and time the entire thing, not just the call itself.
Indeed. That's how you do it with JMH: https://github.com/shipilev/benchmarks-scratch/blob/master/src/main/java/org/sample/ThreadIsInterrupted.java
On my Linux x86_64, JDK 8b129 the difference is minuscule.
-Aleksey
- Previous message: Removing intrinsic of Thread.isInterrupted()
- Next message: Removing intrinsic of Thread.isInterrupted()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the hotspot-compiler-dev mailing list