Skip to Content
Javaの最適化
book

Javaの最適化

by Benjamin J. Evans, James Gough, Chris Newland
March 2025
Intermediate to advanced
440 pages
6h 29m
Japanese
O'Reilly Media, Inc.
Content preview from Javaの最適化

第15章. Java 9と未来

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

新リリースには、Java/JVMアプリケーション・エンジニアに関連する、パフォーマンス関連の機能や機能強化が数多く含まれている。

この章の前半では、Java 9でパフォーマンス・エンジニアが知っておくべきプラットフォームの新機能や変更点について調査する。

Java 8がLambdaとその結果(ストリーム、デフォルト・メソッド、関数型プログラミングの小さな側面)に終始していたように、Java 9はモジュールに終始している。

モジュールは、よくアーキテクトされたアプリを構築するための、非常に現代的な方法である。 しかし、モジュールを採用することの長期的な利点を見出すには、チームやプロジェクトによっては時間がかかるかもしれない。 私たちの目的からすると、モジュールはパフォーマンス上重要ではないため、詳細な議論は行わず、その代わりに、より小さいがパフォーマンスに関連する変更に焦点を当てる。

注

Java 9モジュールに興味のある読者は、Sander MakとPaul Bakker著『Java 9 Modularity』(O'Reilly)など、適切なリファレンスを参照すべきである。

本章の大部分は、執筆時点で存在する将来についての議論で占められている。 Javaプラットフォームのエコシステムには、JVMアプリケーションのパフォーマンス状況を根本的に再構築する可能性を秘めた、進行中のイニシアチブが数多くある。 本書の締めくくりとして、これらのプロジェクトと、Javaパフォーマンス専門家にとってのそれらの関連性を見ていく。

Java 9の小さなパフォーマンス向上

このセクションでは、Java 9で行われた機能強化のうち、パフォーマンスに関連するものについて説明する。その中には非常に小さなものもあるが、アプリケーションによっては重要な意味を持つものもある。 特に、以下のような変更点について説明する:

  • セグメント化されたコードキャッシュ

  • コンパクトな文字列

  • 新しい文字列連結

  • C2コンパイラの改良

  • G1の変更点

分割コードキャッシュ

Java 9で提供された改良点の1つは、コードキャッシュを の領域に分割することである:

  • インタプリタなどの非メソッドコード

  • プロファイリングされたコード(クライアント・コンパイラのレベル2とレベル3)

  • 非推奨コード(レベル1およびレベル4)

この結果、スイーパーの時間が短縮され(非メソッド領域はスイープする必要がなくなる)、完全に最適化されたコードの局所的最適化が向上するはずだ。 セグメント化されたコードキャッシュの欠点は、他の領域にスペースがあるにもかかわらず、1つの領域がいっぱいになってしまう可能性があることだ。

コンパクトな文字列

char[] char は16ビット型なので、これはASCII文字列を格納するために、実際に必要なスペースのおよそ2倍のスペースが使われることを意味する。 プラットフォームは常に、このオーバーヘッドを、Unicode処理を簡素化するために支払う価値のある代償として扱ってきた。

Java 9では、 、文字列をコンパクトにできる可能性がある。 これは文字列ごとに最適化するチャンスである。 文字列がLatin-1で表現できる場合、バイト配列として表現され(バイトはLatin-1文字に対応すると理解される)、 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

ネットワークとKubernetes

ネットワークとKubernetes

James Strong, Vallery Lancey
ファストAPI

ファストAPI

Bill Lubanovic

Publisher Resources

ISBN: 9798341636446