-
Bug
-
Resolution: Unresolved
-
P4
-
repo-valhalla
System.arraycopy flattened to flattened copy - When the target array has static Q-type, it's from 3x times faster (100 elements) to 10% faster (1M elements) than when the target array has static L-type. At the same time, the manual copying loop shows the best performance in all cases (flattened to flattened).
Benchmark (size) Mode Cnt Score Error Units
InlineArrayCopy.Val_to_Val_as_Val_to_Ref_copy 100 avgt 5 57.123 ± 0.181 ns/op
InlineArrayCopy.Val_to_Val_as_Val_to_Val_copy 100 avgt 5 15.934 ± 0.991 ns/op
InlineCopy.Val_to_Val_as_Val_to_Ref_copy 100 avgt 5 18.206 ± 0.376 ns/op
InlineCopy.Val_to_Val_as_Val_to_Val_copy 100 avgt 5 25.067 ± 0.915 ns/op
Benchmarks: http://cr.openjdk.java.net/~skuksenko/valhalla/array_q_vs_l/benchmarks/
Cmd line:
${JAVA_HOME}/bin/java -XX:+EnablePrimitiveClasses --enable-preview -jar target/benchmarks.jar Val_to_Val_as_Val_to_Val_copy Val_to_Val_as_Val_to_Ref_copy
Benchmark (size) Mode Cnt Score Error Units
InlineArrayCopy.Val_to_Val_as_Val_to_Ref_copy 100 avgt 5 57.123 ± 0.181 ns/op
InlineArrayCopy.Val_to_Val_as_Val_to_Val_copy 100 avgt 5 15.934 ± 0.991 ns/op
InlineCopy.Val_to_Val_as_Val_to_Ref_copy 100 avgt 5 18.206 ± 0.376 ns/op
InlineCopy.Val_to_Val_as_Val_to_Val_copy 100 avgt 5 25.067 ± 0.915 ns/op
Benchmarks: http://cr.openjdk.java.net/~skuksenko/valhalla/array_q_vs_l/benchmarks/
Cmd line:
${JAVA_HOME}/bin/java -XX:+EnablePrimitiveClasses --enable-preview -jar target/benchmarks.jar Val_to_Val_as_Val_to_Val_copy Val_to_Val_as_Val_to_Ref_copy