This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fury.git
The following commit(s) were added to refs/heads/main by this push:
new 90259471 perf(java): inline same element invoke in jit (#1851)
90259471 is described below
commit 902594715659345cb85e92855506e6dabba6724d
Author: Shawn Yang <[email protected]>
AuthorDate: Tue Sep 24 01:06:13 2024 -0700
perf(java): inline same element invoke in jit (#1851)
<!--
**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/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/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. -->
## 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/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.
-->
---
.../fury/builder/BaseObjectCodecBuilder.java | 40 ++++++++++------------
1 file changed, 18 insertions(+), 22 deletions(-)
diff --git
a/java/fury-core/src/main/java/org/apache/fury/builder/BaseObjectCodecBuilder.java
b/java/fury-core/src/main/java/org/apache/fury/builder/BaseObjectCodecBuilder.java
index e58098bb..b1b43d36 100644
---
a/java/fury-core/src/main/java/org/apache/fury/builder/BaseObjectCodecBuilder.java
+++
b/java/fury-core/src/main/java/org/apache/fury/builder/BaseObjectCodecBuilder.java
@@ -1278,18 +1278,16 @@ public abstract class BaseObjectCodecBuilder extends
CodecBuilder {
readBuilder.add(
readContainerElements(
elementType, true, elemSerializer, null, buffer, collection,
size));
- Set<Expression> cutPoint = ofHashSet(buffer, collection, size);
- if (maybeDecl) { // For `isDeclType`
- cutPoint.add(flags);
- }
- Expression sameElementClassRead =
- invokeGenerated(ctx, cutPoint, readBuilder,
"sameElementClassRead", false);
// Same element class read end
- action =
- new If(
- sameElementClass,
- sameElementClassRead,
- readContainerElements(elementType, true, null, null, buffer,
collection, size));
+ Set<Expression> cutPoint = ofHashSet(buffer, collection, size);
+ Expression differentElemTypeRead =
+ invokeGenerated(
+ ctx,
+ cutPoint,
+ readContainerElements(elementType, true, null, null, buffer,
collection, size),
+ "differentTypeElemsRead",
+ false);
+ action = new If(sameElementClass, readBuilder, differentElemTypeRead);
} else {
Literal hasNullFlag = Literal.ofInt(CollectionFlags.HAS_NULL);
Expression hasNull = eq(new BitAnd(flags, hasNullFlag), hasNullFlag,
"hasNull");
@@ -1299,18 +1297,16 @@ public abstract class BaseObjectCodecBuilder extends
CodecBuilder {
readBuilder.add(
readContainerElements(
elementType, false, elemSerializer, hasNull, buffer,
collection, size));
- Set<Expression> cutPoint = ofHashSet(buffer, collection, size,
hasNull);
- if (maybeDecl) { // For `isDeclType`
- cutPoint.add(flags);
- }
// Same element class read end
- Expression sameElementClassRead =
- invokeGenerated(ctx, cutPoint, readBuilder,
"sameElementClassRead", false);
- action =
- new If(
- sameElementClass,
- sameElementClassRead,
- readContainerElements(elementType, false, null, hasNull,
buffer, collection, size));
+ Set<Expression> cutPoint = ofHashSet(buffer, collection, size,
hasNull);
+ Expression differentTypeElemsRead =
+ invokeGenerated(
+ ctx,
+ cutPoint,
+ readContainerElements(elementType, false, null, hasNull,
buffer, collection, size),
+ "differentTypeElemsRead",
+ false);
+ action = new If(sameElementClass, readBuilder, differentTypeElemsRead);
}
builder.add(action);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]