Skip to content

Commit 82727e1

Browse files
committed
update
1 parent 4bb76ee commit 82727e1

File tree

119 files changed

+25044
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+25044
-0
lines changed

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
*.iml

Diff for: README.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
# java-benchmark
22
various payload matters
3+
4+
```
5+
mvn compile
6+
schedtool -a 1 -e perf stat -e cycles,instructions,cache-references,cache-misses,page-fa ults,branches,branch-misses mvn exec:java -Dexec.mainClass="com.jsoniter.benchmark.with_1_string_field.DeserJackson"
7+
```
8+
9+
```
10+
--add-opens java.base/java.lang=ALL-UNNAMED
11+
-XX:+CompactStrings
12+
```

Diff for: pom.xml

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?xml version="1.0"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.jsoniter</groupId>
5+
<version>0.9.8-SNAPSHOT</version>
6+
<artifactId>jsoniter-benchmark</artifactId>
7+
<name>json iterator</name>
8+
<description>jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go</description>
9+
<url>http://jsoniter.com</url>
10+
<packaging>jar</packaging>
11+
12+
<licenses>
13+
<license>
14+
<name>MIT License</name>
15+
<url>http://www.opensource.org/licenses/mit-license.php</url>
16+
</license>
17+
</licenses>
18+
19+
<developers>
20+
<developer>
21+
<name>Tao Wen</name>
22+
<email>[email protected]</email>
23+
<organization>jsoniter</organization>
24+
<organizationUrl>http://jsoniter.com</organizationUrl>
25+
</developer>
26+
</developers>
27+
28+
<scm>
29+
<connection>scm:git:git://github.com/json-iterator/java-benchmark.git</connection>
30+
<developerConnection>scm:git:ssh://github.com:json-iterator/java-benchmark.git</developerConnection>
31+
<url>http://github.com/json-iterator/java-benchmark/tree/master</url>
32+
</scm>
33+
34+
<properties>
35+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36+
</properties>
37+
38+
<dependencies>
39+
<dependency>
40+
<groupId>junit</groupId>
41+
<artifactId>junit</artifactId>
42+
<version>4.12</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.javassist</groupId>
46+
<artifactId>javassist</artifactId>
47+
<version>3.21.0-GA</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>com.jsoniter</groupId>
51+
<artifactId>jsoniter</artifactId>
52+
<version>0.9.8-SNAPSHOT</version>
53+
</dependency>
54+
<dependency>
55+
<groupId>org.openjdk.jmh</groupId>
56+
<artifactId>jmh-core</artifactId>
57+
<version>1.17.3</version>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.openjdk.jmh</groupId>
61+
<artifactId>jmh-generator-annprocess</artifactId>
62+
<version>1.17.3</version>
63+
</dependency>
64+
<dependency>
65+
<groupId>com.fasterxml.jackson.core</groupId>
66+
<artifactId>jackson-databind</artifactId>
67+
<version>2.8.5</version>
68+
</dependency>
69+
<dependency>
70+
<groupId>com.fasterxml.jackson.module</groupId>
71+
<artifactId>jackson-module-afterburner</artifactId>
72+
<version>2.8.5</version>
73+
</dependency>
74+
<dependency>
75+
<groupId>com.dslplatform</groupId>
76+
<artifactId>dsl-json</artifactId>
77+
<version>1.3.2</version>
78+
</dependency>
79+
<dependency>
80+
<groupId>org.apache.thrift</groupId>
81+
<artifactId>libthrift</artifactId>
82+
<version>0.10.0</version>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.slf4j</groupId>
86+
<artifactId>slf4j-api</artifactId>
87+
<version>1.7.22</version>
88+
</dependency>
89+
<!--<dependency>-->
90+
<!--<groupId>com.dslplatform</groupId>-->
91+
<!--<artifactId>dsl-json-processor</artifactId>-->
92+
<!--<version>1.4.1</version>-->
93+
<!--</dependency>-->
94+
<dependency>
95+
<groupId>com.alibaba</groupId>
96+
<artifactId>fastjson</artifactId>
97+
<version>1.2.22</version>
98+
</dependency>
99+
<dependency>
100+
<groupId>com.squareup.moshi</groupId>
101+
<artifactId>moshi</artifactId>
102+
<version>1.3.1</version>
103+
</dependency>
104+
<dependency>
105+
<groupId>com.google.protobuf</groupId>
106+
<artifactId>protobuf-java</artifactId>
107+
<version>3.2.0rc2</version>
108+
</dependency>
109+
</dependencies>
110+
111+
<build>
112+
<plugins>
113+
<plugin>
114+
<groupId>org.apache.maven.plugins</groupId>
115+
<artifactId>maven-compiler-plugin</artifactId>
116+
<version>3.6.0</version>
117+
<configuration>
118+
<source>1.8</source>
119+
<target>1.8</target>
120+
<encoding>UTF-8</encoding>
121+
</configuration>
122+
</plugin>
123+
</plugins>
124+
</build>
125+
126+
<distributionManagement>
127+
<snapshotRepository>
128+
<id>ossrh</id>
129+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
130+
</snapshotRepository>
131+
</distributionManagement>
132+
</project>
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.dslplatform.json;
2+
3+
public class CustomJsonReader extends JsonReader {
4+
public CustomJsonReader(byte[] buffer) {
5+
super(buffer, null);
6+
}
7+
public void reset() {
8+
super.reset(length());
9+
}
10+
}

Diff for: src/main/java/com/jsoniter/benchmark/All.java

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.jsoniter.benchmark;
2+
3+
import java.io.File;
4+
import java.net.URL;
5+
import java.net.URLClassLoader;
6+
7+
public class All {
8+
public static void loadJMH() {
9+
URLClassLoader classLoader = (URLClassLoader) All.class.getClassLoader();
10+
StringBuilder classpath = new StringBuilder();
11+
for(URL url : classLoader.getURLs())
12+
classpath.append(url.getPath()).append(File.pathSeparator);
13+
System.setProperty("java.class.path", classpath.toString());
14+
}
15+
}

0 commit comments

Comments
 (0)