Giter Site home page Giter Site logo

java-puzzles's Introduction

Java Benchmark puzzles

SimpleInliningTest

This test shows the performance impact of 2 different (logging) code patterns.

SimpleInliningTest::wrongLong is supposed to be too big (bytecode wise) to be inlined; it can be verified using:

  • the compilation log by running the application with -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining
  • JITWatch by copying the source as it is into the SandBox and playing with it

notes: it uses an ancient and unsafe technique to avoid dead code removal, JMH would be better, but JitWatch's Sandbox is the main consumer of this.

ProfilerFallacyExample

The profilers that worths to be tried are:

  1. JVisualVM CPU Sample Profiler: JvmtiEnv::GetAllStackTraces based
  2. perf-map-agent: "mostly" perf based
  3. async-profiler: AsyncGetCallTrace + perf hybrid

The instruction for the perf-map-agent case are packed directly in the javadoc of the test.

In summary:

  1. JVisualVM could just samples Java stack while on safepoint
  2. perf-map-agent uses perf, can profile any stack (native + Java), but need to force the JVM to preserve the frame pointer and could read broken frames
  3. async-profiler uses perf for native (JVM/Kernel) calls while AsyncGetCallTrace for Java ones (JFR, Solaris Studio do the same) trying to match between the two worlds (could read broken frames on both sides)

notes: Please remember to kill it or it will kill your CPU!!!!Hot stuff

ArrayfillBenchmark

It is mostly based on the awesome Nitsan Wakart article and it helps to understand how most legends around byte[] common operations are false and need proper (and correct) measurements.

java-puzzles's People

Contributors

franz1981 avatar

Watchers

Andrea Tarocchi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.