Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(java): Add ClassInfo ClassBytes generation conditions. (#1667)
<!-- **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. --> `ClassInfo#classNameBytes` and `ClassInfo#packageNameBytes` are only used when `classInfo.classId == NO_CLASS_ID && !metaContextShareEnabled` ```java public void writeClass(MemoryBuffer buffer, ClassInfo classInfo) { if (classInfo.classId == NO_CLASS_ID) { // no class id provided. // use classname if (metaContextShareEnabled) { buffer.writeByte(USE_CLASS_VALUE_FLAG); // FIXME(chaokunyang) Register class but not register serializer can't be used with // meta share mode, because no class def are sent to peer. writeClassWithMetaShare(buffer, classInfo); } else { // if it's null, it's a bug. assert classInfo.packageNameBytes != null; metaStringResolver.writeMetaStringBytesWithFlag(buffer, classInfo.packageNameBytes); assert classInfo.classNameBytes != null; metaStringResolver.writeMetaStringBytes(buffer, classInfo.classNameBytes); } } else { // use classId buffer.writeVarUint32(classInfo.classId << 1); } } ``` ## 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. --> --------- Signed-off-by: LiangliangSui <coolsui.coding@gmail.com>
- Loading branch information