Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b915dd7
Examples for Second Edition
ScottOaks Dec 31, 2019
af272b4
Bump jackson-databind in /SecondEdition/ParsingTest/parsing-benchmark
dependabot[bot] Dec 31, 2019
97c04f7
Merge pull request #1 from ScottOaks/dependabot/maven/SecondEdition/P…
ScottOaks Dec 31, 2019
a98cf8c
Bump jackson-databind in /SecondEdition/ParsingTest/parsing-benchmark
dependabot[bot] Mar 5, 2020
13289dc
Merge pull request #2 from ScottOaks/dependabot/maven/SecondEdition/P…
ScottOaks Mar 5, 2020
e14d6f4
Bump jackson-databind in /SecondEdition/ParsingTest/parsing-benchmark
dependabot[bot] Apr 23, 2020
fbbd3e4
Merge pull request #3 from ScottOaks/dependabot/maven/SecondEdition/P…
ScottOaks Apr 24, 2020
3e86507
Bump jackson-databind in /SecondEdition/ParsingTest/parsing-benchmark
dependabot[bot] Jan 21, 2021
0cb42d0
Merge pull request #5 from ScottOaks/dependabot/maven/SecondEdition/P…
ScottOaks Jan 22, 2021
a0c3a1b
Match code sample in book
ScottOaks May 22, 2021
85e72ff
Bump jackson-databind in /SecondEdition/ParsingTest/parsing-benchmark
dependabot[bot] Dec 9, 2021
cb9b80e
Merge pull request #7 from ScottOaks/dependabot/maven/SecondEdition/P…
ScottOaks Dec 10, 2021
f826841
Bump jackson-databind in /SecondEdition/ParsingTest/parsing-benchmark
dependabot[bot] Oct 5, 2022
bcd0821
Merge pull request #8 from ScottOaks/dependabot/maven/SecondEdition/P…
ScottOaks Oct 5, 2022
353fec5
Bump jackson-databind in /SecondEdition/ParsingTest/parsing-benchmark
dependabot[bot] Oct 19, 2022
77f119b
Merge pull request #9 from ScottOaks/dependabot/maven/SecondEdition/P…
ScottOaks Oct 19, 2022
df28986
update com.fasterxml.jackson.core:jackson-databind 2.13.4.1 to 2.14.0…
pen4 Nov 19, 2022
49d6b37
Merge pull request #10 from pen4/oscs_fix_cdsc58oau51t49so8c8g
ScottOaks Nov 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
80 changes: 80 additions & 0 deletions SecondEdition/AOT/ListDir.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
*
* Subject to the condition set forth below, permission is hereby granted to any
* person obtaining a copy of this software, associated documentation and/or
* data (collectively the "Software"), free of charge and under any and all
* copyright rights in the Software, and any and all patent rights owned or
* freely licensable by each licensor hereunder covering either (i) the
* unmodified Software as contributed to or provided by such licensor, or (ii)
* the Larger Works (as defined below), to deal in both
*
* (a) the Software, and
*
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
* one is included with the Software each a "Larger Work" to which the Software
* is contributed by such licensors),
*
* without restriction, including without limitation the rights to copy, create
* derivative works of, display, perform, and distribute the Software and make,
* use, sell, offer for sale, import, export, have made, and have sold the
* Software and the Larger Work(s), and to sublicense the foregoing rights on
* either these or other terms.
*
* This license is subject to the following condition:
*
* The above copyright notice and either this complete permission notice or at a
* minimum a reference to the UPL must be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Stream;

public class ListDir {
public static void main(String[] args) throws java.io.IOException {

int argc = 0;
boolean wait = false;
if (args[argc].equals("-w")) {
argc++;
wait = true;
}
String root = ".";
if(argc < args.length) {
root = args[argc];
}
System.out.println("Walking path: " + Paths.get(root));

long[] size = {0};
long[] count = {0};

try (Stream<Path> paths = Files.walk(Paths.get(root))) {
paths.filter(Files::isRegularFile).forEach((Path p) -> {
File f = p.toFile();
size[0] += f.length();
count[0] += 1;
});
}

System.out.println("Total: " + count[0] + " files, total size = " + size[0] + " bytes");
if (wait) {
System.out.println("Press return to exit");
System.in.read();
}
}
}
3 changes: 3 additions & 0 deletions SecondEdition/AOT/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

rm -f *.so *.class listDir
Binary file added SecondEdition/AOT/listdir
Binary file not shown.
30 changes: 30 additions & 0 deletions SecondEdition/AOT/run-list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

export TIMEFORMAT=%R
JAVA_HOME=$HOME/VMs/jdk-11.0.5
GRAAL_HOME=$HOME/VMs/graalvm-ee-19.2.1

run() {
i=0
t=0
while [ $i -lt 10 ];
do
t=$(( $t + $( (time $* >& /dev/null) |& awk '{ print $1 * 1000 }') ))
i=$(( $i + 1 ))
done
echo $*: $(( $t / 10 ))
}

compile() {
echo Compiling ListDir.class
$GRAAL_HOME/bin/javac ListDir.java

echo Producing native image
$GRAAL_HOME/bin/native-image ListDir
}

if [ ! -f listdir ]; then
compile
fi
run $JAVA_HOME/bin/java ListDir $1
run ./listdir $1
17 changes: 17 additions & 0 deletions SecondEdition/EpsilonGC/net/sdo/EpsilonTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package net.sdo;

import java.util.ArrayList;

public class EpsilonTest {

private static final ArrayList al = new ArrayList();

public static void main(String[] args) {
System.out.println("Start");
for (int i = 0; i < 4096; i++) {
al.add(new byte[1024*512]);
}
System.out.println("End");
}

}
171 changes: 171 additions & 0 deletions SecondEdition/Exception/exception-benchmark/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<!--
Copyright (c) 2014, Oracle America, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of Oracle nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.sdo</groupId>
<artifactId>exception-benchmark</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>JMH benchmark sample: Java</name>

<!--
This is the demo/sample template build script for building Java benchmarks with JMH.
Edit as needed.
-->

<dependencies>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!--
JMH version to use with this project.
-->
<jmh.version>1.21</jmh.version>

<!--
Java source/target to use for compilation.
-->
<javac.target>1.8</javac.target>

<!--
Name of the benchmark Uber-JAR to generate.
-->
<uberjar.name>benchmarks</uberjar.name>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerVersion>${javac.target}</compilerVersion>
<source>${javac.target}</source>
<target>${javac.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>${uberjar.name}</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.openjdk.jmh.Main</mainClass>
</transformer>
</transformers>
<filters>
<filter>
<!--
Shading signed JARs will fail without this.
http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
-->
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>
Loading