Skip to content

Commit

Permalink
add benchmark data
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Jun 18, 2023
1 parent 102ebf8 commit 4609e88
Show file tree
Hide file tree
Showing 6 changed files with 1,477 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
public class GenReport {
public void gen() throws Exception {
File dir = new File("/Users/wenshao/Work/git/fastjson2/docs/benchmark/");
File file = new File(dir, "benchmark_2.0.33_raw.md");
File outFile = new File(dir, "benchmark_2.0.33.md");
File file = new File(dir, "benchmark_2.0.34_raw.md");
File outFile = new File(dir, "benchmark_2.0.34.md");

Map<String, BenchmarkResult> benchResults = new LinkedHashMap<>();

Expand Down Expand Up @@ -36,6 +36,7 @@ private static void gen(
Map<String, BenchmarkResult> benchResults
) throws FileNotFoundException {
PrintStream out = new PrintStream(new FileOutputStream(outFile));
int h1 = 0;
for (BenchmarkResult benchmarkResult : benchResults.values()) {
if (benchmarkResult.libraryResults.size() == 4) {
LibResult fastjson2 = benchmarkResult.libraryResults.get("fastjson2");
Expand Down Expand Up @@ -119,7 +120,7 @@ private static void gen(
}
}

out.println("## " + benchmarkResult.benchmarkCase);
out.println("## " + (++h1) + " " + benchmarkResult.benchmarkCase);

LibResult firLib = benchmarkResult.libraryResults.values().iterator().next();
Set<String> jdks = firLib.scores.keySet();
Expand All @@ -138,6 +139,7 @@ private static void gen(
out.print("|");
out.println();

Set<String> eccWrited = new HashSet<>();
for (String jdk : jdks) {
double firstScore = benchmarkResult.libraryResults.values().iterator().next().scores.get(jdk);

Expand All @@ -149,9 +151,17 @@ private static void gen(
out.print(" | ");
} else {
String ecs = jdk.substring(0, p);
out.print(ecs);

if (eccWrited.add(ecs)) {
out.print(ecs);
}

out.print(" | ");
out.print(jdk.substring(p + 1));
String jdkinfo = jdk.substring(p + 1);
if (jdkinfo.startsWith("graalvm-jdk-")) {
jdkinfo = "graalvm_" + jdkinfo.substring("graalvm-jdk-".length());
}
out.print(jdkinfo);
}

int i = 0;
Expand All @@ -170,6 +180,49 @@ private static void gen(
}

out.println();

LinkedHashMap<String, String[]> graalvm17_jdks = new LinkedHashMap<>();
String jdk17 = null, graalvm17 = null;
String jdk17_info = null, graalvm17_info = null;
for (String jdk : jdks) {
int p = jdk.indexOf('-');
if (p == -1) {
continue;
}

String ecs = jdk.substring(0, p);
String[] ecs_jdk17s = graalvm17_jdks.get(ecs);
if (ecs_jdk17s == null) {
ecs_jdk17s = new String[2];
graalvm17_jdks.put(ecs, ecs_jdk17s);
}

String jdkinfo = jdk.substring(p + 1);
if (jdkinfo.startsWith("jdk-17.")) {
jdk17 = jdk;
jdk17_info = jdkinfo;
ecs_jdk17s[0] = jdk;
} else if (jdkinfo.startsWith("graalvm-jdk-17.")) {
graalvm17 = jdk;
graalvm17_info = jdkinfo;
ecs_jdk17s[1] = jdk;
}
}

if (jdk17 != null && graalvm17 != null) {
out.println();
out.println("### " + h1 + ".1 jdk17 vs graalvm17");
out.println("| ecs | library | " + jdk17_info + " | " + graalvm17_info + " | delta |");
out.println("|-----|-----|-----|-----|-----|");
for (LibResult libResult : benchmarkResult.libraryResults.values()) {
for (Map.Entry<String, String[]> entry : graalvm17_jdks.entrySet()) {
Double score_jdk17 = libResult.scores.get(entry.getValue()[0]);
Double score_graalvm17 = libResult.scores.get(entry.getValue()[1]);
double percent = (score_graalvm17 - score_jdk17) / score_jdk17;
out.println("| " + entry.getKey() + " | " + libResult.library + " | " + score_jdk17 + " | " + score_graalvm17 + " | " + new DecimalFormat("#,##0.##%").format(percent) + " |");
}
}
}
}
out.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@

public class ReadResult {
public static void main(String[] args) throws Exception {
File outFile = new File("/Users/wenshao/Work/git/fastjson2/docs/benchmark/benchmark_2.0.33_raw.md");
File outFile = new File("/Users/wenshao/Work/git/fastjson2/docs/benchmark/benchmark_2.0.34_raw.md");
// File file = new File("/Users/wenshao/Downloads/result_2.0.25.out");

Map<String, String> files = new LinkedHashMap<>();
files.put("aliyun_ecs.g8i.large", "/Users/wenshao/Downloads/result_2.0.33_g8i.out");
files.put("aliyun_ecs.g8i.large", "/Users/wenshao/Downloads/result_2.0.34_g8i.out");
// files.put("aliyun_ecs.g7.large", "/Users/wenshao/Downloads/result_2.0.33_g7.out");
files.put("aliyun_ecs.g8y.large", "/Users/wenshao/Downloads/result_2.0.33_g8y.out");
files.put("aliyun_ecs.g8y.large", "/Users/wenshao/Downloads/result_2.0.34_g8y.out");
// files.put("aws_ecs.c6g.large", "/Users/wenshao/Downloads/result_2.0.33_aws_c6g.out");
// files.put("aws_ecs.c7g.large", "/Users/wenshao/Downloads/result_2.0.33_aws_c7g.out");
// files.put("OrangePI5", "/Users/wenshao/Downloads/result_2.0.33_orangepi5.out");
files.put("orangepi5p", "/Users/wenshao/Downloads/result_2.0.34_orangepi5.out");

PrintStream out = new PrintStream(new FileOutputStream(outFile));
files.forEach((k, v) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static void jackson() throws Exception {
// zulu8.62.0.19 : 963
// zulu11.52.13 : 1058
// zulu17.32.13 : 1064
// graalvm_17.0.7 600
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static void fastjson2() {
// zulu11.52.13 : 337 314 289
// zulu17.40.19 : 317 320 285
// zulu17.40.19_vec : 267 250
// graalvm_17.0.7 207
}
}

Expand Down
Loading

0 comments on commit 4609e88

Please sign in to comment.