Skip to content

Commit

Permalink
chore(java): add jmh benchmark params to doc (#1488)
Browse files Browse the repository at this point in the history
<!--
**Thanks for contributing to Fury.**

**If this is your first time opening a PR on fury, you can refer to
[CONTRIBUTING.md](https://github.com/apache/incubator-fury/blob/main/CONTRIBUTING.md).**

Contribution Checklist

- The **Apache Fury (incubating)** community has restrictions on the
naming of pr titles. You can also find instructions in
[CONTRIBUTING.md](https://github.com/apache/incubator-fury/blob/main/CONTRIBUTING.md).

- Fury has a strong focus on performance. If the PR you submit will have
an impact on performance, please benchmark it first and provide the
benchmark result here.
-->

## What does this PR do?

<!-- Describe the purpose of this PR. -->
This PR add jmh params to doc, so one can select which benchmark to run
easily for performance optimization

## Related issues

<!--
Is there any related issue? Please attach here.

- #xxxx0
- #xxxx1
- #xxxx2
-->


## Does this PR introduce any user-facing change?

<!--
If any user-facing interface changes, please [open an
issue](https://github.com/apache/incubator-fury/issues/new/choose)
describing the need to do so and update the document if necessary.
-->

- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?


## Benchmark

<!--
When the PR has an impact on performance (if you don't know whether the
PR will have an impact on performance, you can submit the PR first, and
if it will have impact on performance, the code reviewer will explain
it), be sure to attach a benchmark data here.
-->
  • Loading branch information
chaokunyang authored Apr 11, 2024
1 parent 20344b9 commit 730c713
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion java/benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cd ../java && mvn install -DskipTests -Dcheckstyle.skip -Dlicense.skip -Dmaven.j
mvn package -Pjmh
# run benchmark
nohup java -jar target/benchmarks.jar -f 5 -wi 3 -i 5 -t 1 -w 3s -r 5s -rf csv >bench.log 2>&1 &
java -jar target/benchmarks.jar "org.apache.fury.*\.deserialize$" -f 1 -wi 1 -i 3 -t 1 -w 2s -r 2s -rf csv
java -jar target/benchmarks.jar "org.apache.fury.*\.deserialize$" -f 1 -wi 1 -i 3 -t 1 -w 2s -r 2s -rf csv -p objectType=MEDIA_CONTENT -p bufferType=array -p references=false
```

Generate Protobuf/Flatbuffers code manually:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ public Object flatbuffers_deserialize(FlatBuffersState.FlatBuffersUserTypeState
public static void main(String[] args) throws IOException {
if (args.length == 0) {
String commandLine =
"org.apache.fury.*UserTypeDeserializeSuite.kryo* -f 0 -wi 3 -i 3 -t 1 -w 2s -r 2s -rf csv";
"org.apache.fury.*UserTypeDeserializeSuite.fury* -f 1 -wi 5 -i 10 -t 1 -w 2s -r 2s -rf csv "
+ "-p objectType=MEDIA_CONTENT -p bufferType=array -p references=false";
System.out.println(commandLine);
args = commandLine.split(" ");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public ByteArrayOutputStream jdk_serialize(JDKState.JDKUserTypeState state) {
return state.bos;
}

@Benchmark
// @Benchmark
public byte[] jsonb_serialize(JsonbState.JsonbUserTypeState state, Blackhole bh) {
return JsonbState.serialize(bh, state, state.object);
}
Expand All @@ -144,7 +144,8 @@ public Object flatbuffers_serialize(FlatBuffersState.FlatBuffersUserTypeState st
public static void main(String[] args) throws IOException {
if (args.length == 0) {
String commandLine =
"org.apache.fury.*UserTypeSerializeSuite.jsonb_serialize -f 3 -wi 3 -i 3 -t 1 -w 2s -r 2s -rf csv";
"org.apache.fury.*UserTypeSerializeSuite.fury -f 3 -wi 5 -i 10 -t 1 -w 2s -r 2s -rf csv "
+ "-p objectType=MEDIA_CONTENT -p bufferType=array -p references=false";
System.out.println(commandLine);
args = commandLine.split(" ");
}
Expand Down

0 comments on commit 730c713

Please sign in to comment.