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 f23f7178 feat(java): Add fastpath for collection/map serialize and
deserialize (#2050)
f23f7178 is described below
commit f23f71781fb7b83b20265118eadf6c7c91835c0a
Author: hn <[email protected]>
AuthorDate: Mon Feb 10 20:52:52 2025 +0800
feat(java): Add fastpath for collection/map serialize and deserialize
(#2050)
<!--
**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?
Add fastpath serialize and deserialize for hashmap and arraylist type
<!-- 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.
-->
---------
Co-authored-by: hening <[email protected]>
---
.../src/main/java/org/apache/fury/Fury.java | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/java/fury-core/src/main/java/org/apache/fury/Fury.java
b/java/fury-core/src/main/java/org/apache/fury/Fury.java
index 3d567587..5d7429e2 100644
--- a/java/fury-core/src/main/java/org/apache/fury/Fury.java
+++ b/java/fury-core/src/main/java/org/apache/fury/Fury.java
@@ -607,6 +607,16 @@ public final class Fury implements BaseFury {
case ClassResolver.STRING_CLASS_ID:
stringSerializer.writeJavaString(buffer, (String) obj);
break;
+ case ClassResolver.ARRAYLIST_CLASS_ID:
+ depth++;
+ arrayListSerializer.write(buffer, (ArrayList) obj);
+ depth--;
+ break;
+ case ClassResolver.HASHMAP_CLASS_ID:
+ depth++;
+ hashMapSerializer.write(buffer, (HashMap) obj);
+ depth--;
+ break;
// TODO(add fastpath for other types)
default:
depth++;
@@ -980,6 +990,16 @@ public final class Fury implements BaseFury {
return buffer.readFloat64();
case ClassResolver.STRING_CLASS_ID:
return stringSerializer.readJavaString(buffer);
+ case ClassResolver.ARRAYLIST_CLASS_ID:
+ depth++;
+ Object list = arrayListSerializer.read(buffer);
+ depth--;
+ return list;
+ case ClassResolver.HASHMAP_CLASS_ID:
+ depth++;
+ Object map = hashMapSerializer.read(buffer);
+ depth--;
+ return map;
// TODO(add fastpath for other types)
default:
depth++;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]