immutable: List.of vs unmodifiableList vs copyOf - null handling, views vs copies, JMH wrap/copy overhead, a Guava comparison, and the record defensive-copy trap
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
mvn -q -B compile
|
||||
GUAVA_JAR="$(find "$HOME/.m2" -name 'guava-*.jar' ! -name '*sources*' | head -1)"
|
||||
CP="target/classes:${GUAVA_JAR}"
|
||||
|
||||
java -cp "$CP" com.ankurm.immutable.NullHandlingDemo 2>&1 \
|
||||
| grep -vE 'JAVA_TOOL_OPTIONS|^WARNING' > output/01-null-handling.txt
|
||||
java -cp "$CP" com.ankurm.immutable.ViewsVsCopiesDemo 2>&1 \
|
||||
| grep -vE 'JAVA_TOOL_OPTIONS|^WARNING' > output/02-views-vs-copies.txt
|
||||
java -cp "$CP" com.ankurm.immutable.GuavaComparisonDemo 2>&1 \
|
||||
| grep -vE 'JAVA_TOOL_OPTIONS|^WARNING' > output/03-guava-comparison.txt
|
||||
java -cp "$CP" com.ankurm.immutable.DefensiveCopyRecordDemo 2>&1 \
|
||||
| grep -vE 'JAVA_TOOL_OPTIONS|^WARNING' > output/04-defensive-copy-record.txt
|
||||
|
||||
mvn -q -B package -DskipTests
|
||||
java -jar target/benchmarks.jar -rf text -rff output/05-jmh-raw.txt
|
||||
|
||||
mvn -q -B test
|
||||
cp target/surefire-reports/com.ankurm.immutable.ImmutableCollectionsTest.txt output/06-tests.txt
|
||||
|
||||
echo "Regenerated output/01-06. Note: 05-jmh-raw.txt numbers are indicative - this sandbox is shared."
|
||||
Reference in New Issue
Block a user