-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
1,777 additions
and
0 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
benchmark/src/main/java/com/alibaba/fastjson2/benchmark/issues/Issue2407.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.alibaba.fastjson2.benchmark.issues; | ||
|
||
import com.alibaba.fastjson2.JSON; | ||
import com.alibaba.fastjson2.annotation.JSONField; | ||
import org.apache.commons.io.IOUtils; | ||
import org.openjdk.jmh.annotations.Benchmark; | ||
import org.openjdk.jmh.infra.Blackhole; | ||
|
||
import java.io.InputStream; | ||
|
||
public class Issue2407 { | ||
static String str; | ||
|
||
static { | ||
try { | ||
InputStream is = Issue2407.class.getClassLoader().getResourceAsStream("issue/issue2407.json"); | ||
str = IOUtils.toString(is, "UTF-8"); | ||
} catch (Throwable ex) { | ||
ex.printStackTrace(); | ||
} | ||
} | ||
|
||
@Benchmark | ||
public void parseArray(Blackhole bh) { | ||
bh.consume( | ||
JSON.parseArray(str) | ||
); | ||
} | ||
|
||
@Benchmark | ||
public void parseArray1(Blackhole bh) { | ||
bh.consume( | ||
JSON.parseArray(str, Bean.class) | ||
); | ||
} | ||
|
||
public class Bean { | ||
public String content; | ||
public String hostName; | ||
public String uniqueKey; | ||
public String originalAppName; | ||
public String odinLeaf; | ||
public long logTime; | ||
public long logId; | ||
public String appName; | ||
public String queryFrom; | ||
public String logName; | ||
public int isService; | ||
public long pathId; | ||
public String timestamp; | ||
public long collectTime; | ||
public String fileKey; | ||
public String parentPath; | ||
public long offset; | ||
public long preOffset; | ||
@JSONField(name = "ENV_ODIN_SU") | ||
public String envOdinSu; | ||
} | ||
} |
Oops, something went wrong.