echeipesh / h3-benchmark

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Specialization boxing example and benchmark

This projects shows the difference how the not careful functions override of the specialized parent trait can lead to the boxing overhead.

Run benchmarks to generate JFR output

$ sbt 
$ clean
$ benchOnly com/pomadchin/raster/bench/LocalTileBench.scala
$ benchOnly com/pomadchin/raster/bench/LocalTileBoxingBench.scala

Results

All inheritents of the original specialized trait, should have narrowed specialized functions declarations. The absence of it in one of the classes in the hierarchy leads to the non specialized method invocation.

The output could be opened via JDK Mission Control with the following results:

LocalTileBoxingBench

boxing

LocalTileBench

unboxed

About

License:MIT License


Languages

Language:Scala 100.0%