• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. HotSpot
  4. PerformanceTechniques

Page History

Versions Compared

Old Version 6

changes.mady.by.user John Rose

Saved on Mar 01, 2009

compared with

New Version 7

changes.mady.by.user John Rose

Saved on Oct 22, 2009

  • Previous Change: Difference between versions 5 and 6
  • Next Change: Difference between versions 7 and 8
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Getting solid performance measurements is surprisingly tricky. Take extra care with micro-benchmarks.

See below for a list of relevant presentations and papers.

Here is another slice on the same information, from another angle: PerformanceTacticIndex.

Constants

  • Use constants when you can.
  • It's OK to store them in local variables; the SSA representation tends to keep them visible.
  • It's OK to store them in static final fields, too.
  • Static final fields can hold non-primitive, non-string constants.
  • The class of a static final field value is also constant, as is the array length (if it's an array).

...

  • Use a disassembler if available to inspect the generated code.
  • Switches are profiled but the profile information is poorly used. For now, consider building an initial decision tree if you know one or two cases are really common.
  • Exception throwing compiles to a goto, if the thrower and catcher inline together. For such uses, rely on preallocated or cloned exceptions, or override the fillInStackTrace part of exception creation, which is an expensive, reflective native call.
  • Do not use jsr/ret. Just clone your finally code if you have to.
  • If you are compiling a non-Java language, consider using standard mangling conventions.
  • If you are generating almost the same class many times in a row, with small variations, factor out the repeating parts into a superclass or static helper class.
  • For small variations in the remaining part, consider using a single named class as a template and loading it multiple times as an anonymous class with constant pool edits. Anonymous classes load and unload faster than named ones.

Presentations and Papers

  • Buckley & Rose, Towards a Universal VM, Oracle Open World 2009. Includes summary of HotSpot optimizations.
  • Schwaighofer, Tail Call Optimization in the Java HotSpot VM, Master's thesis, Johannes Kepler University Linz, 2009. Pages 23-35 are a good introduction to HotSpot architecture.
Overview
Content Tools
ThemeBuilder

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.21
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 297, "requestCorrelationId": "4e3380705635c382"}