JEP draft: Enhanced ManderblotSet demo using value types
|Component||hotspot / test|
Develop a sample application to demonstrate performance and memory improvements gained by use of Valhalla project components, Value Types and Generics over Primitive Types.
Valhalla project introduced a possibility for user to define custom immutable primitive type, a value type. Also it was decided to expand generics functionality allowing generics to handle primitive types.
All this lead to the measurable performance and memory improvements.
To demonstrate this improvements and show users how to use this new functionality, it was decided to develop a sample application and bundle it with JDK samples.
Since value types allow user to extend the existing set of primitive types with their custom type, like a complex number, the best area to make a sample from will be Math.
In JDK8 there is a sample, MandelbrotSet, which compares parallel and sequential stream api. It refers to a particular instance of fractal set. https://en.wikipedia.org/wiki/Mandelbrot_set
The way this sample has been developed perfectly demonstrates stream api comparison however is not efficient from memory layout point of view and contains a number of workarounds for that.
Value types and Generics over Primitive Types will allow to remove this workarounds, rewrite the application to demonstrate performance and memory improvements.
We will not only update the existing application but sooner use its general idea to efficiently implement MandelbrotSet algorithm using another lemniscate.