SlideShare a Scribd company logo
1 of 88
Copyright © 2019 Oracle and/or its affiliates.
Does Java need inline(value) types?
What project Valhalla can bring to Java from a performance perspective.
Java Platform Group
Oracle
November, 2019
Sergey Kuksenko
InfoQ.com: News & Community Site
• Over 1,000,000 software developers, architects and CTOs read the site world-
wide every month
• 250,000 senior developers subscribe to our weekly newsletter
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• 2 dedicated podcast channels: The InfoQ Podcast, with a focus on
Architecture and The Engineering Culture Podcast, with a focus on building
• 96 deep dives on innovative topics packed as downloadable emags and
minibooks
• Over 40 new content items per week
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
java-valhalla-inline-types/
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Presented at QCon San Francisco
www.qconsf.com
The following is intended to outline our general product direction. It is intended for information purposes
only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing decisions. The development,
release, timing, and pricing of any features or functionality described for Oracle’s products may change
and remains at the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and
prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed
discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and
Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q
under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website
at http://www.oracle.com/investor. All information in this presentation is current as of September 2019
and Oracle undertakes no duty to update any statement in light of new information or future events.
Safe Harbor
Copyright © 2019 Oracle and/or its affiliates.
Who am I?
- Java/JVM Performance Engineer at Oracle, @since 2010
- Java/JVM Performance Engineer, @since 2005
- Java/JVM Engineer, @since 1996
Copyright © 2019 Oracle and/or its affiliates.
What is Valhalla?
Copyright © 2019 Oracle and/or its affiliates.
Presenter’s Title
Organization
Month 00, 2019
Presenter’s Name
Presenter’s Title
Organization
Month 00, 2019
Presenter’s Name
Copyright © 2019 Oracle and/or its affiliates.
Valhalla Goals
• Provide denser memory layout (inline/value types)
• Specialized generics (including primitive, value types)
• Smooth library migration
• JVM cleanup (e.g. Nestmates a.k.a. JEP-181)
Copyright © 2019 Oracle and/or its affiliates.
Object Identity is the root of all evil
Copyright © 2019 Oracle and/or its affiliates.
Identity gives
• Indirection
• Allocation in heap
• Nullability
• Mutability
• Reference equality (==)
• Locking
• Puzzlers, e.g.
Integer.valueOf(42) == Integer.valueOf(42)
but
Integer.valueOf(420) != Integer.valueOf(420)
Copyright © 2019 Oracle and/or its affiliates.
Why JVM can’t eliminate it?
Copyright © 2019 Oracle and/or its affiliates.
JVM can!
Copyright © 2019 Oracle and/or its affiliates.
JVM can!
Copyright © 2019 Oracle and/or its affiliates.
JVM can, but ...
~300 articles per
year!
Copyright © 2019 Oracle and/or its affiliates.
Inline class
• is a class
• no identity
• immutable
• not nullable
• no synchronization
Copyright © 2019 Oracle and/or its affiliates.
Inline class
public inline class Complex {
private double re;
private double im;
public Complex(double re, double im) {
this.re = re;
this.im = im;
}
public double re() { return re; }
public double im() { return im; }
...
Copyright © 2019 Oracle and/or its affiliates.
Inline class
public inline class Complex {
private double re;
private double im;
public Complex(double re, double im) {
this.re = re;
this.im = im;
}
public double re() { return re; }
public double im() { return im; }
...
final
im
plies
extends Object
im
plies
implements I1,...,In
allows
Copyright © 2019 Oracle and/or its affiliates.
Identity of indiscernibles
‘==’ on inline classes
deny at all
always false substitutability check
(recursive ‘==’ for each field)
OR
current choice
Copyright © 2019 Oracle and/or its affiliates.
Inline class means inlineable
• JVM decides if:
●
allocate on heap
OR
●
put on stack (locals, parameters, result)
●
inline into container class
●
inline into array (flattened array)
Copyright © 2019 Oracle and/or its affiliates.
Inline class
• Inline types are subtypes of Object (interface)
• Inline arrays are covariant with Object[]
(arrays of interface)
Copyright © 2019 Oracle and/or its affiliates.
Boxing vs boxing
• V? - nullable twin of ‘V’
• means all values of V + ‘null’
• Integer - nullable twin of ‘int’
• But Integer has full identity
compare to:
Float like a butterfly, Sting like a bee
Code like a class, Work like an int
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Local variable
int count(Complex c) {
Complex z = c;
for (int i = 1; i < MAX_ITERATION; i++) {
if (z.modulus() >= 4.0) return i;
z = z.square().add(c);
}
return MAX_ITERATION;
}
Copyright © 2019 Oracle and/or its affiliates.
Local variable
int count(Complex c) {
Complex z = c;
for (int i = 1; i < MAX_ITERATION; i++) {
if (z.modulus() >= 4.0) return i;
z = z.square().add(c);
}
return MAX_ITERATION;
}
Copyright © 2019 Oracle and/or its affiliates.
Local variable
int count(Complex c) {
Complex z = c;
for (int i = 1; i < MAX_ITERATION; i++) {
if (z.modulus() >= 4.0) return i;
z = z.square().add(c);
}
return MAX_ITERATION;
}
Copyright © 2019 Oracle and/or its affiliates.
Reference vs Inline (Mandelbrot, 500x500)
Inline class:
• 4x less data loads
• 42x less L1 cache misses
• 5x less L3 cache misses
• 5x less dTLB misses
Copyright © 2019 Oracle and/or its affiliates.
Scalability (Mandelbrot, 500x500)
16x
Copyright © 2019 Oracle and/or its affiliates.
Method parameters/result
static Value ackermann(Value x, Value y) {
return x.isZero() ? y.inc() :
(y.isZero() ? ackermann(x.dec(), new Value(1)) :
ackermann(x.dec(), ackermann(x, y.dec())));
}
Copyright © 2019 Oracle and/or its affiliates.
Method parameters/result
static Value ackermann(Value x, Value y) {
return x.isZero() ? y.inc() :
(y.isZero() ? ackermann(x.dec(), new Value(1)) :
ackermann(x.dec(), ackermann(x, y.dec())));
}
Copyright © 2019 Oracle and/or its affiliates.
Array access
ref a
b
c
a
b
c
VS
Copyright © 2019 Oracle and/or its affiliates.
Array Random Access
Copyright © 2019 Oracle and/or its affiliates.
Array Sequential Access
Collateral Damage
in legacy world
Copyright © 2019 Oracle and/or its affiliates.
The following section is intended to outline Valhalla
current status and development. It is intended for
information purposes only, and may not be incorporated
into any contract (or slowdown blaming). Any adverted
performance regression maybe a subject to removal.
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Inline in heap (“boxing”)
• Object o = my_inline_value;
• Interface i = my_inline_value;
• Value? nullable_value = my_inline_value;
• JVM decided
Copyright © 2019 Oracle and/or its affiliates.
Reference comparison
just compare it if <both refs are inline>
if <classes are same>
then
check substitutability
else
false
else
just compare it
Glorious pre Valhalla past Brighter post Valhalla future
Copyright © 2019 Oracle and/or its affiliates.
If object is inline class
Mark Word
Klass ptr
My Object
Class Desc
ptr
Copyright © 2019 Oracle and/or its affiliates.
If object is inline class
Mark Word
Klass ptr
My Object
Class Desc
ptr
Use Mark Word
Copyright © 2019 Oracle and/or its affiliates.
Mark Word
// 64 bits:
// --------
// unused:25 hash:31 -->| unused:1 age:4 biased_lock:1 lock:2 (normal object)
// JavaThread*:54 epoch:2 unused:1 age:4 biased_lock:1 lock:2 (biased object)
// "1" :54 epoch:2 unused:1 age:4 biased_lock:1 lock:2 (biased always locked object)
// PromotedObject*:61 --------------------->| promo_bits:3 ----->| (CMS promoted object)
// size:64 ----------------------------------------------------->| (CMS free block)
//
// unused:25 hash:31 -->| cms_free:1 age:4 biased_lock:1 lock:2 (COOPs && normal object)
// JavaThread*:54 epoch:2 cms_free:1 age:4 biased_lock:1 lock:2 (COOPs && biased object)
// narrowOop:32 unused:24 cms_free:1 unused:4 promo_bits:3 ----->| (COOPs && CMS promoted object)
// unused:21 size:35 -->| cms_free:1 unused:7 ------------------>| (COOPs && CMS free block)
Copyright © 2019 Oracle and/or its affiliates.
Mark Word
// 64 bits:
// --------
// unused:25 hash:31 -->| unused:1 age:4 biased_lock:1 lock:2 (normal object)
// JavaThread*:54 epoch:2 unused:1 age:4 biased_lock:1 lock:2 (biased object)
// "1" :54 epoch:2 unused:1 age:4 biased_lock:1 lock:2 (biased always locked object)
// PromotedObject*:61 --------------------->| promo_bits:3 ----->| (CMS promoted object)
// size:64 ----------------------------------------------------->| (CMS free block)
//
// unused:25 hash:31 -->| cms_free:1 age:4 biased_lock:1 lock:2 (COOPs && normal object)
// JavaThread*:54 epoch:2 cms_free:1 age:4 biased_lock:1 lock:2 (COOPs && biased object)
// narrowOop:32 unused:24 cms_free:1 unused:4 promo_bits:3 ----->| (COOPs && CMS promoted object)
// unused:21 size:35 -->| cms_free:1 unused:7 ------------------>| (COOPs && CMS free block)
// [ <unused> | larval |1| epoch | age | 1 | 01] permanently locked
Copyright © 2019 Oracle and/or its affiliates.
Reference comparison a.k.a. ‘acmp’
...
if (o1 == o2) {
... = x + 1;
} else {
... = x - 1;
}
...
Copyright © 2019 Oracle and/or its affiliates.
acmp –XX:–EnableValhalla
cmp %rdx,%rcx
inc %eax dec %eax
Copyright © 2019 Oracle and/or its affiliates.
acmp –XX:+EnableValhalla
cmp %rdx,%rcx
inc %eax
dec %eax
test %rcx,%rcx
mov $0x405,%r10
and (%rcx),%r10
cmp $0x405,%r10
mov 0x8(%rdx),%r11
mov 0x8(%rcx),%r10
cmp %r11,%r10
test %rdx,%rdx
#invokedynamic
...
Copyright © 2019 Oracle and/or its affiliates.
acmp –XX:+EnableValhalla
cmp %rdx,%rcx
inc %eax
dec %eax
test %rcx,%rcx
mov $0x405,%r10
and (%rcx),%r10
cmp $0x405,%r10
mov 0x8(%rdx),%r11
mov 0x8(%rcx),%r10
cmp %r11,%r10
test %rdx,%rdx
#invokedynamic
...
Value
World
Reference
World
Copyright © 2019 Oracle and/or its affiliates.
acmp
• Complex code
• Additional loads
• invokedynamic prevents loop unrolling
Copyright © 2019 Oracle and/or its affiliates.
acmp performance
Copyright © 2019 Oracle and/or its affiliates.
synchronized(obj)
do all synch stuff if <ref is inline class>
then
throw exception
else
do all synch stuff
Glorious pre Valhalla past Brighter post Valhalla future
Copyright © 2019 Oracle and/or its affiliates.
synchronized(obj)
do all synch stuff if <ref is inline class>
then
throw exception
else
do all synch stuff
< 1% difference
Glorious pre Valhalla past Brighter post Valhalla future
Copyright © 2019 Oracle and/or its affiliates.
Arrays (Object[])
• Good old reference array
• Array of inline classes in heap
●
references, but not nullable
• Flattened array of inline classes
Object[] may be:
Copyright © 2019 Oracle and/or its affiliates.
Arrays (Object[])
Mark Word
Klass ptr
My Array Class Desc
ptr
length
Copyright © 2019 Oracle and/or its affiliates.
Arrays (Object[])
Mark Word
Klass ptr
My Array Class Desc
ptr
length
flattened_bit
null_free_bit
Copyright © 2019 Oracle and/or its affiliates.
Arrays (Object[])
• Any access to Klass ptr required clearing:
●
and $0x1fffffff,%reg
• HotSpot is good enough at eliminating it
●
knowing that it isn’t an array
Copyright © 2019 Oracle and/or its affiliates.
Load from Object[]
element size is the same:
just load it
if <array is flattened>
find element size
load it
do boxing if needed
else
just load it
Glorious pre Valhalla past Brighter post Valhalla future
Copyright © 2019 Oracle and/or its affiliates.
Store to Object[]
do ArrayStoreCheck
store if ok
do ArrayStoreCheck
if <array is flattened>
find element size
do unboxing if needed
store
else
store
Glorious pre Valhalla past Brighter post Valhalla future
Copyright © 2019 Oracle and/or its affiliates.
Object[] access
• Targeting benchmarks: –2% . . – 10%
• Solution: aggressive loop hoisting and loop duplication
(in progress)
Copyright © 2019 Oracle and/or its affiliates.
Inline vs inline
Integer[] i1 = new Integer[1000];
Integer[] i2 = new Integer[1000];
@Setup
public void setup() {
for (int i = 0; i < 1000; i++)
i1[i] = i2[i] = i;
i2[999] = 394857623;
}
@Benchmark
public boolean arrayEquals() {
return Arrays.equals(i1, i2);
}
Copyright © 2019 Oracle and/or its affiliates.
Inline vs inline
Integer[] i1 = new Integer[1000];
Integer[] i2 = new Integer[1000];
@Setup
public void setup() {
for (int i = 0; i < 1000; i++)
i1[i] = i2[i] = i;
i2[999] = 394857623;
}
@Benchmark
public boolean arrayEquals() {
return Arrays.equals(i1, i2);
}
Copyright © 2019 Oracle and/or its affiliates.
Methods inline tree
-XX:-EnableValhalla
...
- @ java.util.Arrays::equals [..., bytes=57, insts=352]
(inlined: inline (hot))
- @ java.util.Objects::equals [..., bytes=23, insts=128]
(inlined: inline (hot))
-XX:+EnableValhalla
...
- @ java.util.Arrays::equals [..., bytes=57, insts=1760]
(inline failed: already compiled into a big method)
Copyright © 2019 Oracle and/or its affiliates.
Methods inline tree
-XX:-EnableValhalla
...
- @ java.util.Arrays::equals [..., bytes=57, insts=352]
(inlined: inline (hot))
- @ java.util.Objects::equals [..., bytes=23, insts=128]
(inlined: inline (hot))
-XX:+EnableValhalla
...
- @ java.util.Arrays::equals [..., bytes=57, insts=1760]
(inline failed: already compiled into a big method)
Size of
generated code
Copyright © 2019 Oracle and/or its affiliates.
Current status
• Checked ~30 big benchmarks:
●
No regressions more than 2%
• Checked ~1600 microbenchmarks:
●
1200 – ±0% at the first run
●
300 – fixed
●
100 – less 5% (in progress)
●
1 – 14% regression (in progress)
Brighter post Valhalla future
Copyright © 2019 Oracle and/or its affiliates.
Presenter’s Title
Organization
Month 00, 2019
Copyright © 2019 Oracle and/or its affiliates.
Arithmetic types
• Complex matrix multiplication (100x100)
ref Complex 12.6 ms
inline Complex 2.7 ms
inline Complex +
cache friendly
algorithm
2.1 ms
Copyright © 2019 Oracle and/or its affiliates.
java.util.Optional
public class HashMap<K,V> ... {
...
/**
* Returns the value to which the specified key is mapped,
* or null if this map contains no mapping for the key.
...
*/
public V get(Object key)
Copyright © 2019 Oracle and/or its affiliates.
java.util.Optional
public class HashMap<K,V> ... {
...
/**
* Returns the value to which the specified key is mapped,
* or null if this map contains no mapping for the key.
...
*/
public V get(Object key)
Not a good idea
Copyright © 2019 Oracle and/or its affiliates.
java.util.Optional
public class HashMap<K,V> ... {
...
/**
* Returns an Optional describing the value to which the specified
* key is mapped, or an empty Optional if this map contains no
* mapping for the key.
...
*/
public Optional<V> get(Object key)
What if?
Copyright © 2019 Oracle and/or its affiliates.
java.util.Optional
• 1000000 gets from 1000000 map
Copyright © 2019 Oracle and/or its affiliates.
Example: map with complex key
• Map from <K1
, …, KN
> → <V>
Two ways to implement:
1. Map<CompositeKey<K1
, …, KN
>, V>
2. Map<K1
, Map …, Map<KN
, V>...>
Copyright © 2019 Oracle and/or its affiliates.
Example: Map from <Integer, Integer> <Integer>→ <Integer>
• 1000000 gets from 1000000 map
Copyright © 2019 Oracle and/or its affiliates.
HashMap inside
key
value
next
key
value
next
Entry
Entry
key
value
next
Entry
key
value
next
Entry
vs
key
value
next
key
value
next
key
value
next
key
value
next
Entry
Copyright © 2019 Oracle and/or its affiliates.
HashMap experiments
• Classic HashMap.get(): ~75 ns
• Experimental HashMap.get(): ~60 ns
? Faster only for large maps
? ‘put’ is slower
... to be continued
Copyright © 2019 Oracle and/or its affiliates.
Iteration
HashMap<Integer, Integer> map; // map.size() == 1000000
@Benchmark
public int sumValuesInMap() {
int s = 0;
for (Integer i : map.values()) {
s += i;
}
return s;
}
Copyright © 2019 Oracle and/or its affiliates.
Iteration
HashMap<Integer, Integer> map; // map.size() == 1000000
@Benchmark
public int sumValuesInMap() {
int s = 0;
for (Integer i : map.values()) {
s += i;
}
return s;
}
Lucky case 33 ms
Unlucky case 55 ms
Copyright © 2019 Oracle and/or its affiliates.
Iteration
HashMap<Integer, Integer> map; // map.size() == 1000000
@Benchmark
public int sumValuesInMap() {
int s = 0;
for (Iterator<Integer> iterator = map.values().iterator();
iterator.hasNext(); ) {
s += iterator.next();
}
return s;
}
scalarized Lucky case 33 ms
on heap Unlucky case 55 ms
Copyright © 2019 Oracle and/or its affiliates.
Inside HashMap
abstract class HashIterator {
...
Node<K,V> next; // next entry to return
Node<K,V> current; // current entry
final Node<K,V> nextNode() {
...
if ((next = (current = e).next) == null && (t = table) != null) {
do {}
while (index < t.length && (next = t[index++]) == null);
}
return e;
}
...
Copyright © 2019 Oracle and/or its affiliates.
Inside HashMap
abstract class HashIterator {
...
Node<K,V> next; // next entry to return
Node<K,V> current; // current entry
final Node<K,V> nextNode() {
...
if ((next = (current = e).next) == null && (t = table) != null) {
do {}
while (index < t.length && (next = t[index++]) == null);
}
return e;
}
...
Write to reference field
GC write barriers
Copyright © 2019 Oracle and/or its affiliates.
inline Cursor
public interface Cursor<V> {
boolean hasElement();
V get();
Cursor<V> next();
}
Copyright © 2019 Oracle and/or its affiliates.
inline Cursor
@Benchmark
public int sumValuesInMap() {
int s = 0;
for (Cursor<Integer> cursor = map.values().cursor();
cursor.hasElement();
cursor = cursor.next()) {
s += cursor.get();
}
return s;
}
Copyright © 2019 Oracle and/or its affiliates.
inline Cursor
@Benchmark
public int sumValuesInMap() {
int s = 0;
for (Cursor<Integer> cursor = map.values().cursor();
cursor.hasElement();
cursor = cursor.next()) {
s += cursor.get();
}
return s;
}
Scalarized Iterator 33 ms
On heap Iterator 55 ms
inline Cursor 32 ms
Copyright © 2019 Oracle and/or its affiliates.
Move/Copy data
• Reference – easy, only reference is moved
• Inline – all data should be moved
– Sort:
Reference – default TimSort from JDK
Inline – reimplented TimSort
indexed Inline – sort ‘int’ indices first, then copy
Copyright © 2019 Oracle and/or its affiliates.
size==400, fit into L1 cache
Copyright © 2019 Oracle and/or its affiliates.
size==4000, fit into L2 cache
Copyright © 2019 Oracle and/or its affiliates.
size==40000, fit into L3 cache
Copyright © 2019 Oracle and/or its affiliates.
size==400000, slightly > L3 cache
Copyright © 2019 Oracle and/or its affiliates.
size==4000000, much more L3 cache
Copyright © 2019 Oracle and/or its affiliates.
Move/Copy data
• Dense location is better than moving less
Copyright © 2019 Oracle and/or its affiliates.
Inline classes
• Dense, HW-friendly memory layout
• More control on heap allocations:
●
less GC pressure
●
less GC barriers
Better performance!
Copyright © 2019 Oracle and/or its affiliates.
Links
• Wiki:
https://wiki.openjdk.java.net/display/valhalla/Main
• Mailing lists:
http://mail.openjdk.java.net/mailman/listinfo/valhalla-dev
http://mail.openjdk.java.net/mailman/listinfo/valhalla-spec-observers
• Repository:
http://hg.openjdk.java.net/valhalla
Thank You
Copyright © 2019 Oracle and/or its affiliates.
Java Platform Group
Oracle
November, 2019
Sergey Kuksenko
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
java-valhalla-inline-types/

More Related Content

What's hot

Burns jsf-confess-2015
Burns jsf-confess-2015Burns jsf-confess-2015
Burns jsf-confess-2015Edward Burns
 
Project Jigsaw in JDK9
Project Jigsaw in JDK9Project Jigsaw in JDK9
Project Jigsaw in JDK9Simon Ritter
 
Functional Programming With Lambdas and Streams in JDK8
 Functional Programming With Lambdas and Streams in JDK8 Functional Programming With Lambdas and Streams in JDK8
Functional Programming With Lambdas and Streams in JDK8IndicThreads
 
What's New in Java 8
What's New in Java 8What's New in Java 8
What's New in Java 8javafxpert
 
Java: Create The Future Keynote
Java: Create The Future KeynoteJava: Create The Future Keynote
Java: Create The Future KeynoteSimon Ritter
 
Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Edward Burns
 
Java Programming | Java Tutorial For Beginners | Java Training | Edureka
Java Programming | Java Tutorial For Beginners | Java Training | EdurekaJava Programming | Java Tutorial For Beginners | Java Training | Edureka
Java Programming | Java Tutorial For Beginners | Java Training | EdurekaEdureka!
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Edward Burns
 
JSF 2.2 Input Output JavaLand 2015
JSF 2.2 Input Output JavaLand 2015JSF 2.2 Input Output JavaLand 2015
JSF 2.2 Input Output JavaLand 2015Edward Burns
 
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]David Buck
 
JSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworksJSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworksDmitry Kornilov
 
Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8Simon Ritter
 
MySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and ScalabilityMySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and ScalabilityShivji Kumar Jha
 
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...Edureka!
 
Introduction to Loops in Java | For, While, Do While, Infinite Loops | Edureka
Introduction to Loops in Java | For, While, Do While, Infinite Loops | EdurekaIntroduction to Loops in Java | For, While, Do While, Infinite Loops | Edureka
Introduction to Loops in Java | For, While, Do While, Infinite Loops | EdurekaEdureka!
 
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...Edureka!
 
What Is Java | Java Tutorial | Java Programming | Learn Java | Edureka
What Is Java | Java Tutorial | Java Programming | Learn Java | EdurekaWhat Is Java | Java Tutorial | Java Programming | Learn Java | Edureka
What Is Java | Java Tutorial | Java Programming | Learn Java | EdurekaEdureka!
 
55 New Features in Java SE 8
55 New Features in Java SE 855 New Features in Java SE 8
55 New Features in Java SE 8Simon Ritter
 
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...Edureka!
 

What's hot (20)

Burns jsf-confess-2015
Burns jsf-confess-2015Burns jsf-confess-2015
Burns jsf-confess-2015
 
Project Jigsaw in JDK9
Project Jigsaw in JDK9Project Jigsaw in JDK9
Project Jigsaw in JDK9
 
Java 101
Java 101Java 101
Java 101
 
Functional Programming With Lambdas and Streams in JDK8
 Functional Programming With Lambdas and Streams in JDK8 Functional Programming With Lambdas and Streams in JDK8
Functional Programming With Lambdas and Streams in JDK8
 
What's New in Java 8
What's New in Java 8What's New in Java 8
What's New in Java 8
 
Java: Create The Future Keynote
Java: Create The Future KeynoteJava: Create The Future Keynote
Java: Create The Future Keynote
 
Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015
 
Java Programming | Java Tutorial For Beginners | Java Training | Edureka
Java Programming | Java Tutorial For Beginners | Java Training | EdurekaJava Programming | Java Tutorial For Beginners | Java Training | Edureka
Java Programming | Java Tutorial For Beginners | Java Training | Edureka
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.
 
JSF 2.2 Input Output JavaLand 2015
JSF 2.2 Input Output JavaLand 2015JSF 2.2 Input Output JavaLand 2015
JSF 2.2 Input Output JavaLand 2015
 
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]
 
JSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworksJSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworks
 
Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8
 
MySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and ScalabilityMySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and Scalability
 
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
 
Introduction to Loops in Java | For, While, Do While, Infinite Loops | Edureka
Introduction to Loops in Java | For, While, Do While, Infinite Loops | EdurekaIntroduction to Loops in Java | For, While, Do While, Infinite Loops | Edureka
Introduction to Loops in Java | For, While, Do While, Infinite Loops | Edureka
 
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...
 
What Is Java | Java Tutorial | Java Programming | Learn Java | Edureka
What Is Java | Java Tutorial | Java Programming | Learn Java | EdurekaWhat Is Java | Java Tutorial | Java Programming | Learn Java | Edureka
What Is Java | Java Tutorial | Java Programming | Learn Java | Edureka
 
55 New Features in Java SE 8
55 New Features in Java SE 855 New Features in Java SE 8
55 New Features in Java SE 8
 
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
 

Similar to Does Java Need Inline Types? What Project Valhalla Can Bring to Java

MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL ShellMySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL ShellMiguel Araújo
 
General Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajevGeneral Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajevOracle Developers
 
Confoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetConfoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetDave Stokes
 
Nonblocking Database Access in Helidon SE
Nonblocking Database Access in Helidon SENonblocking Database Access in Helidon SE
Nonblocking Database Access in Helidon SEDmitry Kornilov
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsDavid Delabassee
 
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...Miguel Araújo
 
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...Mohamedcpcbma
 
GraalVM Native Images by Oleg Selajev @shelajev
GraalVM Native Images by Oleg Selajev @shelajevGraalVM Native Images by Oleg Selajev @shelajev
GraalVM Native Images by Oleg Selajev @shelajevOracle Developers
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsDavid Delabassee
 
Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Shaun Smith
 
Interactive Java Support to your tool -- The JShell API and Architecture
Interactive Java Support to your tool -- The JShell API and ArchitectureInteractive Java Support to your tool -- The JShell API and Architecture
Interactive Java Support to your tool -- The JShell API and ArchitectureJavaDayUA
 
Intro to GraphQL for Database Developers
Intro to GraphQL for Database DevelopersIntro to GraphQL for Database Developers
Intro to GraphQL for Database DevelopersDaniel McGhan
 
How to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL ShellHow to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL ShellFrederic Descamps
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreDave Stokes
 
2015 JavaOne LAD JSF 2.3 & MVC 1.0
2015 JavaOne LAD JSF 2.3 & MVC 1.02015 JavaOne LAD JSF 2.3 & MVC 1.0
2015 JavaOne LAD JSF 2.3 & MVC 1.0mnriem
 
OOW16 - Advanced Architectures for Oracle E-Business Suite [CON6705]
OOW16 - Advanced Architectures for Oracle E-Business Suite [CON6705]OOW16 - Advanced Architectures for Oracle E-Business Suite [CON6705]
OOW16 - Advanced Architectures for Oracle E-Business Suite [CON6705]vasuballa
 
MySQL Connector/J Feature Review and How to Upgrade from Connector/J 5.1
MySQL Connector/J Feature Review and How to Upgrade from Connector/J 5.1MySQL Connector/J Feature Review and How to Upgrade from Connector/J 5.1
MySQL Connector/J Feature Review and How to Upgrade from Connector/J 5.1Filipe Silva
 
Building Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationBuilding Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationFredrik Öhrström
 

Similar to Does Java Need Inline Types? What Project Valhalla Can Bring to Java (20)

MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL ShellMySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
 
General Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajevGeneral Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajev
 
Confoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetConfoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSet
 
Nonblocking Database Access in Helidon SE
Nonblocking Database Access in Helidon SENonblocking Database Access in Helidon SE
Nonblocking Database Access in Helidon SE
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
 
Oracle NoSQL
Oracle NoSQLOracle NoSQL
Oracle NoSQL
 
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
 
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
2019 dev-marc sewtz-session-keynote-oracle_apex_19__neue_features_und_roadmap...
 
GraalVM Native Images by Oleg Selajev @shelajev
GraalVM Native Images by Oleg Selajev @shelajevGraalVM Native Images by Oleg Selajev @shelajev
GraalVM Native Images by Oleg Selajev @shelajev
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and Triumphs
 
Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019
 
Interactive Java Support to your tool -- The JShell API and Architecture
Interactive Java Support to your tool -- The JShell API and ArchitectureInteractive Java Support to your tool -- The JShell API and Architecture
Interactive Java Support to your tool -- The JShell API and Architecture
 
Intro to GraphQL for Database Developers
Intro to GraphQL for Database DevelopersIntro to GraphQL for Database Developers
Intro to GraphQL for Database Developers
 
How to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL ShellHow to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL Shell
 
JVMs in Containers
JVMs in ContainersJVMs in Containers
JVMs in Containers
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document Store
 
2015 JavaOne LAD JSF 2.3 & MVC 1.0
2015 JavaOne LAD JSF 2.3 & MVC 1.02015 JavaOne LAD JSF 2.3 & MVC 1.0
2015 JavaOne LAD JSF 2.3 & MVC 1.0
 
OOW16 - Advanced Architectures for Oracle E-Business Suite [CON6705]
OOW16 - Advanced Architectures for Oracle E-Business Suite [CON6705]OOW16 - Advanced Architectures for Oracle E-Business Suite [CON6705]
OOW16 - Advanced Architectures for Oracle E-Business Suite [CON6705]
 
MySQL Connector/J Feature Review and How to Upgrade from Connector/J 5.1
MySQL Connector/J Feature Review and How to Upgrade from Connector/J 5.1MySQL Connector/J Feature Review and How to Upgrade from Connector/J 5.1
MySQL Connector/J Feature Review and How to Upgrade from Connector/J 5.1
 
Building Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationBuilding Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integration
 

More from C4Media

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoC4Media
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileC4Media
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020C4Media
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsC4Media
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No KeeperC4Media
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like OwnersC4Media
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideC4Media
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDC4Media
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine LearningC4Media
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at SpeedC4Media
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsC4Media
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsC4Media
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerC4Media
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleC4Media
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeC4Media
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereC4Media
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing ForC4Media
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data EngineeringC4Media
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 
Navigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsNavigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsC4Media
 

More from C4Media (20)

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy Mobile
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No Keeper
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like Owners
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate Guide
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 
Navigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsNavigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery Teams
 

Recently uploaded

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Does Java Need Inline Types? What Project Valhalla Can Bring to Java

  • 1. Copyright © 2019 Oracle and/or its affiliates. Does Java need inline(value) types? What project Valhalla can bring to Java from a performance perspective. Java Platform Group Oracle November, 2019 Sergey Kuksenko
  • 2. InfoQ.com: News & Community Site • Over 1,000,000 software developers, architects and CTOs read the site world- wide every month • 250,000 senior developers subscribe to our weekly newsletter • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • 2 dedicated podcast channels: The InfoQ Podcast, with a focus on Architecture and The Engineering Culture Podcast, with a focus on building • 96 deep dives on innovative topics packed as downloadable emags and minibooks • Over 40 new content items per week Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/ java-valhalla-inline-types/
  • 3. Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide Presented at QCon San Francisco www.qconsf.com
  • 4. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and Oracle undertakes no duty to update any statement in light of new information or future events. Safe Harbor Copyright © 2019 Oracle and/or its affiliates.
  • 5. Who am I? - Java/JVM Performance Engineer at Oracle, @since 2010 - Java/JVM Performance Engineer, @since 2005 - Java/JVM Engineer, @since 1996 Copyright © 2019 Oracle and/or its affiliates.
  • 6. What is Valhalla? Copyright © 2019 Oracle and/or its affiliates. Presenter’s Title Organization Month 00, 2019 Presenter’s Name Presenter’s Title Organization Month 00, 2019 Presenter’s Name
  • 7. Copyright © 2019 Oracle and/or its affiliates. Valhalla Goals • Provide denser memory layout (inline/value types) • Specialized generics (including primitive, value types) • Smooth library migration • JVM cleanup (e.g. Nestmates a.k.a. JEP-181)
  • 8. Copyright © 2019 Oracle and/or its affiliates. Object Identity is the root of all evil
  • 9. Copyright © 2019 Oracle and/or its affiliates. Identity gives • Indirection • Allocation in heap • Nullability • Mutability • Reference equality (==) • Locking • Puzzlers, e.g. Integer.valueOf(42) == Integer.valueOf(42) but Integer.valueOf(420) != Integer.valueOf(420)
  • 10. Copyright © 2019 Oracle and/or its affiliates. Why JVM can’t eliminate it?
  • 11. Copyright © 2019 Oracle and/or its affiliates. JVM can!
  • 12. Copyright © 2019 Oracle and/or its affiliates. JVM can!
  • 13. Copyright © 2019 Oracle and/or its affiliates. JVM can, but ... ~300 articles per year!
  • 14. Copyright © 2019 Oracle and/or its affiliates. Inline class • is a class • no identity • immutable • not nullable • no synchronization
  • 15. Copyright © 2019 Oracle and/or its affiliates. Inline class public inline class Complex { private double re; private double im; public Complex(double re, double im) { this.re = re; this.im = im; } public double re() { return re; } public double im() { return im; } ...
  • 16. Copyright © 2019 Oracle and/or its affiliates. Inline class public inline class Complex { private double re; private double im; public Complex(double re, double im) { this.re = re; this.im = im; } public double re() { return re; } public double im() { return im; } ... final im plies extends Object im plies implements I1,...,In allows
  • 17. Copyright © 2019 Oracle and/or its affiliates. Identity of indiscernibles ‘==’ on inline classes deny at all always false substitutability check (recursive ‘==’ for each field) OR current choice
  • 18. Copyright © 2019 Oracle and/or its affiliates. Inline class means inlineable • JVM decides if: ● allocate on heap OR ● put on stack (locals, parameters, result) ● inline into container class ● inline into array (flattened array)
  • 19. Copyright © 2019 Oracle and/or its affiliates. Inline class • Inline types are subtypes of Object (interface) • Inline arrays are covariant with Object[] (arrays of interface)
  • 20. Copyright © 2019 Oracle and/or its affiliates. Boxing vs boxing • V? - nullable twin of ‘V’ • means all values of V + ‘null’ • Integer - nullable twin of ‘int’ • But Integer has full identity compare to:
  • 21. Float like a butterfly, Sting like a bee Code like a class, Work like an int Copyright © 2019 Oracle and/or its affiliates.
  • 22. Copyright © 2019 Oracle and/or its affiliates. Local variable int count(Complex c) { Complex z = c; for (int i = 1; i < MAX_ITERATION; i++) { if (z.modulus() >= 4.0) return i; z = z.square().add(c); } return MAX_ITERATION; }
  • 23. Copyright © 2019 Oracle and/or its affiliates. Local variable int count(Complex c) { Complex z = c; for (int i = 1; i < MAX_ITERATION; i++) { if (z.modulus() >= 4.0) return i; z = z.square().add(c); } return MAX_ITERATION; }
  • 24. Copyright © 2019 Oracle and/or its affiliates. Local variable int count(Complex c) { Complex z = c; for (int i = 1; i < MAX_ITERATION; i++) { if (z.modulus() >= 4.0) return i; z = z.square().add(c); } return MAX_ITERATION; }
  • 25. Copyright © 2019 Oracle and/or its affiliates. Reference vs Inline (Mandelbrot, 500x500) Inline class: • 4x less data loads • 42x less L1 cache misses • 5x less L3 cache misses • 5x less dTLB misses
  • 26. Copyright © 2019 Oracle and/or its affiliates. Scalability (Mandelbrot, 500x500) 16x
  • 27. Copyright © 2019 Oracle and/or its affiliates. Method parameters/result static Value ackermann(Value x, Value y) { return x.isZero() ? y.inc() : (y.isZero() ? ackermann(x.dec(), new Value(1)) : ackermann(x.dec(), ackermann(x, y.dec()))); }
  • 28. Copyright © 2019 Oracle and/or its affiliates. Method parameters/result static Value ackermann(Value x, Value y) { return x.isZero() ? y.inc() : (y.isZero() ? ackermann(x.dec(), new Value(1)) : ackermann(x.dec(), ackermann(x, y.dec()))); }
  • 29. Copyright © 2019 Oracle and/or its affiliates. Array access ref a b c a b c VS
  • 30. Copyright © 2019 Oracle and/or its affiliates. Array Random Access
  • 31. Copyright © 2019 Oracle and/or its affiliates. Array Sequential Access
  • 32. Collateral Damage in legacy world Copyright © 2019 Oracle and/or its affiliates.
  • 33. The following section is intended to outline Valhalla current status and development. It is intended for information purposes only, and may not be incorporated into any contract (or slowdown blaming). Any adverted performance regression maybe a subject to removal. Copyright © 2019 Oracle and/or its affiliates.
  • 34. Copyright © 2019 Oracle and/or its affiliates. Inline in heap (“boxing”) • Object o = my_inline_value; • Interface i = my_inline_value; • Value? nullable_value = my_inline_value; • JVM decided
  • 35. Copyright © 2019 Oracle and/or its affiliates. Reference comparison just compare it if <both refs are inline> if <classes are same> then check substitutability else false else just compare it Glorious pre Valhalla past Brighter post Valhalla future
  • 36. Copyright © 2019 Oracle and/or its affiliates. If object is inline class Mark Word Klass ptr My Object Class Desc ptr
  • 37. Copyright © 2019 Oracle and/or its affiliates. If object is inline class Mark Word Klass ptr My Object Class Desc ptr Use Mark Word
  • 38. Copyright © 2019 Oracle and/or its affiliates. Mark Word // 64 bits: // -------- // unused:25 hash:31 -->| unused:1 age:4 biased_lock:1 lock:2 (normal object) // JavaThread*:54 epoch:2 unused:1 age:4 biased_lock:1 lock:2 (biased object) // "1" :54 epoch:2 unused:1 age:4 biased_lock:1 lock:2 (biased always locked object) // PromotedObject*:61 --------------------->| promo_bits:3 ----->| (CMS promoted object) // size:64 ----------------------------------------------------->| (CMS free block) // // unused:25 hash:31 -->| cms_free:1 age:4 biased_lock:1 lock:2 (COOPs && normal object) // JavaThread*:54 epoch:2 cms_free:1 age:4 biased_lock:1 lock:2 (COOPs && biased object) // narrowOop:32 unused:24 cms_free:1 unused:4 promo_bits:3 ----->| (COOPs && CMS promoted object) // unused:21 size:35 -->| cms_free:1 unused:7 ------------------>| (COOPs && CMS free block)
  • 39. Copyright © 2019 Oracle and/or its affiliates. Mark Word // 64 bits: // -------- // unused:25 hash:31 -->| unused:1 age:4 biased_lock:1 lock:2 (normal object) // JavaThread*:54 epoch:2 unused:1 age:4 biased_lock:1 lock:2 (biased object) // "1" :54 epoch:2 unused:1 age:4 biased_lock:1 lock:2 (biased always locked object) // PromotedObject*:61 --------------------->| promo_bits:3 ----->| (CMS promoted object) // size:64 ----------------------------------------------------->| (CMS free block) // // unused:25 hash:31 -->| cms_free:1 age:4 biased_lock:1 lock:2 (COOPs && normal object) // JavaThread*:54 epoch:2 cms_free:1 age:4 biased_lock:1 lock:2 (COOPs && biased object) // narrowOop:32 unused:24 cms_free:1 unused:4 promo_bits:3 ----->| (COOPs && CMS promoted object) // unused:21 size:35 -->| cms_free:1 unused:7 ------------------>| (COOPs && CMS free block) // [ <unused> | larval |1| epoch | age | 1 | 01] permanently locked
  • 40. Copyright © 2019 Oracle and/or its affiliates. Reference comparison a.k.a. ‘acmp’ ... if (o1 == o2) { ... = x + 1; } else { ... = x - 1; } ...
  • 41. Copyright © 2019 Oracle and/or its affiliates. acmp –XX:–EnableValhalla cmp %rdx,%rcx inc %eax dec %eax
  • 42. Copyright © 2019 Oracle and/or its affiliates. acmp –XX:+EnableValhalla cmp %rdx,%rcx inc %eax dec %eax test %rcx,%rcx mov $0x405,%r10 and (%rcx),%r10 cmp $0x405,%r10 mov 0x8(%rdx),%r11 mov 0x8(%rcx),%r10 cmp %r11,%r10 test %rdx,%rdx #invokedynamic ...
  • 43. Copyright © 2019 Oracle and/or its affiliates. acmp –XX:+EnableValhalla cmp %rdx,%rcx inc %eax dec %eax test %rcx,%rcx mov $0x405,%r10 and (%rcx),%r10 cmp $0x405,%r10 mov 0x8(%rdx),%r11 mov 0x8(%rcx),%r10 cmp %r11,%r10 test %rdx,%rdx #invokedynamic ... Value World Reference World
  • 44. Copyright © 2019 Oracle and/or its affiliates. acmp • Complex code • Additional loads • invokedynamic prevents loop unrolling
  • 45. Copyright © 2019 Oracle and/or its affiliates. acmp performance
  • 46. Copyright © 2019 Oracle and/or its affiliates. synchronized(obj) do all synch stuff if <ref is inline class> then throw exception else do all synch stuff Glorious pre Valhalla past Brighter post Valhalla future
  • 47. Copyright © 2019 Oracle and/or its affiliates. synchronized(obj) do all synch stuff if <ref is inline class> then throw exception else do all synch stuff < 1% difference Glorious pre Valhalla past Brighter post Valhalla future
  • 48. Copyright © 2019 Oracle and/or its affiliates. Arrays (Object[]) • Good old reference array • Array of inline classes in heap ● references, but not nullable • Flattened array of inline classes Object[] may be:
  • 49. Copyright © 2019 Oracle and/or its affiliates. Arrays (Object[]) Mark Word Klass ptr My Array Class Desc ptr length
  • 50. Copyright © 2019 Oracle and/or its affiliates. Arrays (Object[]) Mark Word Klass ptr My Array Class Desc ptr length flattened_bit null_free_bit
  • 51. Copyright © 2019 Oracle and/or its affiliates. Arrays (Object[]) • Any access to Klass ptr required clearing: ● and $0x1fffffff,%reg • HotSpot is good enough at eliminating it ● knowing that it isn’t an array
  • 52. Copyright © 2019 Oracle and/or its affiliates. Load from Object[] element size is the same: just load it if <array is flattened> find element size load it do boxing if needed else just load it Glorious pre Valhalla past Brighter post Valhalla future
  • 53. Copyright © 2019 Oracle and/or its affiliates. Store to Object[] do ArrayStoreCheck store if ok do ArrayStoreCheck if <array is flattened> find element size do unboxing if needed store else store Glorious pre Valhalla past Brighter post Valhalla future
  • 54. Copyright © 2019 Oracle and/or its affiliates. Object[] access • Targeting benchmarks: –2% . . – 10% • Solution: aggressive loop hoisting and loop duplication (in progress)
  • 55. Copyright © 2019 Oracle and/or its affiliates. Inline vs inline Integer[] i1 = new Integer[1000]; Integer[] i2 = new Integer[1000]; @Setup public void setup() { for (int i = 0; i < 1000; i++) i1[i] = i2[i] = i; i2[999] = 394857623; } @Benchmark public boolean arrayEquals() { return Arrays.equals(i1, i2); }
  • 56. Copyright © 2019 Oracle and/or its affiliates. Inline vs inline Integer[] i1 = new Integer[1000]; Integer[] i2 = new Integer[1000]; @Setup public void setup() { for (int i = 0; i < 1000; i++) i1[i] = i2[i] = i; i2[999] = 394857623; } @Benchmark public boolean arrayEquals() { return Arrays.equals(i1, i2); }
  • 57. Copyright © 2019 Oracle and/or its affiliates. Methods inline tree -XX:-EnableValhalla ... - @ java.util.Arrays::equals [..., bytes=57, insts=352] (inlined: inline (hot)) - @ java.util.Objects::equals [..., bytes=23, insts=128] (inlined: inline (hot)) -XX:+EnableValhalla ... - @ java.util.Arrays::equals [..., bytes=57, insts=1760] (inline failed: already compiled into a big method)
  • 58. Copyright © 2019 Oracle and/or its affiliates. Methods inline tree -XX:-EnableValhalla ... - @ java.util.Arrays::equals [..., bytes=57, insts=352] (inlined: inline (hot)) - @ java.util.Objects::equals [..., bytes=23, insts=128] (inlined: inline (hot)) -XX:+EnableValhalla ... - @ java.util.Arrays::equals [..., bytes=57, insts=1760] (inline failed: already compiled into a big method) Size of generated code
  • 59. Copyright © 2019 Oracle and/or its affiliates. Current status • Checked ~30 big benchmarks: ● No regressions more than 2% • Checked ~1600 microbenchmarks: ● 1200 – ±0% at the first run ● 300 – fixed ● 100 – less 5% (in progress) ● 1 – 14% regression (in progress)
  • 60. Brighter post Valhalla future Copyright © 2019 Oracle and/or its affiliates. Presenter’s Title Organization Month 00, 2019
  • 61. Copyright © 2019 Oracle and/or its affiliates. Arithmetic types • Complex matrix multiplication (100x100) ref Complex 12.6 ms inline Complex 2.7 ms inline Complex + cache friendly algorithm 2.1 ms
  • 62. Copyright © 2019 Oracle and/or its affiliates. java.util.Optional public class HashMap<K,V> ... { ... /** * Returns the value to which the specified key is mapped, * or null if this map contains no mapping for the key. ... */ public V get(Object key)
  • 63. Copyright © 2019 Oracle and/or its affiliates. java.util.Optional public class HashMap<K,V> ... { ... /** * Returns the value to which the specified key is mapped, * or null if this map contains no mapping for the key. ... */ public V get(Object key) Not a good idea
  • 64. Copyright © 2019 Oracle and/or its affiliates. java.util.Optional public class HashMap<K,V> ... { ... /** * Returns an Optional describing the value to which the specified * key is mapped, or an empty Optional if this map contains no * mapping for the key. ... */ public Optional<V> get(Object key) What if?
  • 65. Copyright © 2019 Oracle and/or its affiliates. java.util.Optional • 1000000 gets from 1000000 map
  • 66. Copyright © 2019 Oracle and/or its affiliates. Example: map with complex key • Map from <K1 , …, KN > → <V> Two ways to implement: 1. Map<CompositeKey<K1 , …, KN >, V> 2. Map<K1 , Map …, Map<KN , V>...>
  • 67. Copyright © 2019 Oracle and/or its affiliates. Example: Map from <Integer, Integer> <Integer>→ <Integer> • 1000000 gets from 1000000 map
  • 68. Copyright © 2019 Oracle and/or its affiliates. HashMap inside key value next key value next Entry Entry key value next Entry key value next Entry vs key value next key value next key value next key value next Entry
  • 69. Copyright © 2019 Oracle and/or its affiliates. HashMap experiments • Classic HashMap.get(): ~75 ns • Experimental HashMap.get(): ~60 ns ? Faster only for large maps ? ‘put’ is slower ... to be continued
  • 70. Copyright © 2019 Oracle and/or its affiliates. Iteration HashMap<Integer, Integer> map; // map.size() == 1000000 @Benchmark public int sumValuesInMap() { int s = 0; for (Integer i : map.values()) { s += i; } return s; }
  • 71. Copyright © 2019 Oracle and/or its affiliates. Iteration HashMap<Integer, Integer> map; // map.size() == 1000000 @Benchmark public int sumValuesInMap() { int s = 0; for (Integer i : map.values()) { s += i; } return s; } Lucky case 33 ms Unlucky case 55 ms
  • 72. Copyright © 2019 Oracle and/or its affiliates. Iteration HashMap<Integer, Integer> map; // map.size() == 1000000 @Benchmark public int sumValuesInMap() { int s = 0; for (Iterator<Integer> iterator = map.values().iterator(); iterator.hasNext(); ) { s += iterator.next(); } return s; } scalarized Lucky case 33 ms on heap Unlucky case 55 ms
  • 73. Copyright © 2019 Oracle and/or its affiliates. Inside HashMap abstract class HashIterator { ... Node<K,V> next; // next entry to return Node<K,V> current; // current entry final Node<K,V> nextNode() { ... if ((next = (current = e).next) == null && (t = table) != null) { do {} while (index < t.length && (next = t[index++]) == null); } return e; } ...
  • 74. Copyright © 2019 Oracle and/or its affiliates. Inside HashMap abstract class HashIterator { ... Node<K,V> next; // next entry to return Node<K,V> current; // current entry final Node<K,V> nextNode() { ... if ((next = (current = e).next) == null && (t = table) != null) { do {} while (index < t.length && (next = t[index++]) == null); } return e; } ... Write to reference field GC write barriers
  • 75. Copyright © 2019 Oracle and/or its affiliates. inline Cursor public interface Cursor<V> { boolean hasElement(); V get(); Cursor<V> next(); }
  • 76. Copyright © 2019 Oracle and/or its affiliates. inline Cursor @Benchmark public int sumValuesInMap() { int s = 0; for (Cursor<Integer> cursor = map.values().cursor(); cursor.hasElement(); cursor = cursor.next()) { s += cursor.get(); } return s; }
  • 77. Copyright © 2019 Oracle and/or its affiliates. inline Cursor @Benchmark public int sumValuesInMap() { int s = 0; for (Cursor<Integer> cursor = map.values().cursor(); cursor.hasElement(); cursor = cursor.next()) { s += cursor.get(); } return s; } Scalarized Iterator 33 ms On heap Iterator 55 ms inline Cursor 32 ms
  • 78. Copyright © 2019 Oracle and/or its affiliates. Move/Copy data • Reference – easy, only reference is moved • Inline – all data should be moved – Sort: Reference – default TimSort from JDK Inline – reimplented TimSort indexed Inline – sort ‘int’ indices first, then copy
  • 79. Copyright © 2019 Oracle and/or its affiliates. size==400, fit into L1 cache
  • 80. Copyright © 2019 Oracle and/or its affiliates. size==4000, fit into L2 cache
  • 81. Copyright © 2019 Oracle and/or its affiliates. size==40000, fit into L3 cache
  • 82. Copyright © 2019 Oracle and/or its affiliates. size==400000, slightly > L3 cache
  • 83. Copyright © 2019 Oracle and/or its affiliates. size==4000000, much more L3 cache
  • 84. Copyright © 2019 Oracle and/or its affiliates. Move/Copy data • Dense location is better than moving less
  • 85. Copyright © 2019 Oracle and/or its affiliates. Inline classes • Dense, HW-friendly memory layout • More control on heap allocations: ● less GC pressure ● less GC barriers Better performance!
  • 86. Copyright © 2019 Oracle and/or its affiliates. Links • Wiki: https://wiki.openjdk.java.net/display/valhalla/Main • Mailing lists: http://mail.openjdk.java.net/mailman/listinfo/valhalla-dev http://mail.openjdk.java.net/mailman/listinfo/valhalla-spec-observers • Repository: http://hg.openjdk.java.net/valhalla
  • 87. Thank You Copyright © 2019 Oracle and/or its affiliates. Java Platform Group Oracle November, 2019 Sergey Kuksenko
  • 88. Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/ java-valhalla-inline-types/