You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fury.apache.org by "theweipeng (via GitHub)" <gi...@apache.org> on 2024/04/10 12:37:55 UTC

[PR] feat(JavaScript) implement xlang protocol [incubator-fury]

theweipeng opened a new pull request, #1487:
URL: https://github.com/apache/incubator-fury/pull/1487

   <!--
   **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?
   1. Remove unsigned types which are removed in xlang protocol.
   2. Remove the binary type, as it could be perfectly replaced by an int8 array.
   3. Rename  `long int double` to `int64  int32 float64` to ensure consistency with other languages
   4. Implements the float16 writer and float16 reader.
   ## Related issues
   
   
   ## Does this PR introduce any user-facing change?
   The JavaScript implementation has not been released yet, so there are no user-facing changes.
   
   ## Benchmark
   There are no fluctuations in the benchmark.
   
   | (index)  | serialize | deserialize |
   |----------|-----------|-------------|
   | fury     | 116       | 118         |
   | protobuf | 25        | 33          |
   | json     | 20        | 23          |
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [PR] feat(JavaScript): implement xlang protocol [incubator-fury]

Posted by "LiangliangSui (via GitHub)" <gi...@apache.org>.
LiangliangSui commented on code in PR #1487:
URL: https://github.com/apache/incubator-fury/pull/1487#discussion_r1560517624


##########
javascript/packages/fury/lib/classResolver.ts:
##########
@@ -84,35 +84,34 @@ export default class SerializerResolver {
   private writeStringIndex: number[] = [];
 
   private registerSerializer(fury: Fury, description: TypeDescription) {
-    return fury.classResolver.registerSerializerById(description.type, generateSerializer(fury, description));
+    return fury.classResolver.registerSerializerById(SerializerResolver.getTypeIdByInternalSerializerType(description.type), generateSerializer(fury, description));
   }
 
   private initInternalSerializer(fury: Fury) {
     this.registerSerializer(fury, Type.string());
     this.registerSerializer(fury, Type.array(Type.any()));
     this.registerSerializer(fury, Type.map(Type.any(), Type.any()));
     this.registerSerializer(fury, Type.bool());
-    this.registerSerializer(fury, Type.uint8());
     this.registerSerializer(fury, Type.int8());
-    this.registerSerializer(fury, Type.uint16());
     this.registerSerializer(fury, Type.int16());
-    this.registerSerializer(fury, Type.uint32());
     this.registerSerializer(fury, Type.int32());
-    this.registerSerializer(fury, Type.uint64());
+    this.registerSerializer(fury, Type.varInt32());
     this.registerSerializer(fury, Type.int64());
-    this.registerSerializer(fury, Type.float());
-    this.registerSerializer(fury, Type.double());
+    this.registerSerializer(fury, Type.sliInt64());
+    this.registerSerializer(fury, Type.float16());
+    this.registerSerializer(fury, Type.float32());
+    this.registerSerializer(fury, Type.float64());
     this.registerSerializer(fury, Type.timestamp());
-    this.registerSerializer(fury, Type.date());
+    this.registerSerializer(fury, Type.duration());
     this.registerSerializer(fury, Type.set(Type.any()));
     this.registerSerializer(fury, Type.binary());
-    this.registerSerializer(fury, Type.stringTypedArray());
-    this.registerSerializer(fury, Type.boolTypedArray());
-    this.registerSerializer(fury, Type.shortTypedArray());
-    this.registerSerializer(fury, Type.intTypedArray());
-    this.registerSerializer(fury, Type.longTypedArray());
-    this.registerSerializer(fury, Type.floatTypedArray());
-    this.registerSerializer(fury, Type.doubleTypedArray());
+    this.registerSerializer(fury, Type.boolArray());

Review Comment:
   `int8Array` should also be added here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [PR] feat(JavaScript) implement xlang protocol [incubator-fury]

Posted by "theweipeng (via GitHub)" <gi...@apache.org>.
theweipeng commented on PR #1487:
URL: https://github.com/apache/incubator-fury/pull/1487#issuecomment-2047438880

   @LiangliangSui @chaokunyang  Hi, This PR addresses the numeric part of the xlang protocol; could you please help review it? The other parts of the protocol will be submitted in another PR.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [PR] feat(JavaScript): implement xlang protocol [incubator-fury]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on code in PR #1487:
URL: https://github.com/apache/incubator-fury/pull/1487#discussion_r1560411086


##########
javascript/packages/fury/lib/meta.ts:
##########
@@ -85,6 +85,12 @@ export const getMeta = (description: TypeDescription, fury: Fury): Meta => {
         needToWriteRef: Boolean(fury.config.refTracking) && false,
         type,
       };
+    case InternalSerializerType.BINARY:
+      return {
+        fixedSize: 8,
+        needToWriteRef: Boolean(fury.config.refTracking) && true,

Review Comment:
   ```suggestion
           needToWriteRef: Boolean(fury.config.refTracking),
   ```
   
   seems `&& true` is unnecessary



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [PR] feat(JavaScript): implement xlang protocol [incubator-fury]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on code in PR #1487:
URL: https://github.com/apache/incubator-fury/pull/1487#discussion_r1560471277


##########
javascript/packages/fury/lib/gen/datetime.ts:
##########
@@ -72,5 +72,5 @@ class DateSerializerGenerator extends BaseSerializerGenerator {
   }
 }
 
-CodegenRegistry.register(InternalSerializerType.DATE, DateSerializerGenerator);
+CodegenRegistry.register(InternalSerializerType.DURATION, DateSerializerGenerator);

Review Comment:
   ```suggestion
   CodegenRegistry.register(InternalSerializerType.DURATION, DurationSerializerGenerator);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [PR] feat(JavaScript): implement xlang protocol [incubator-fury]

Posted by "theweipeng (via GitHub)" <gi...@apache.org>.
theweipeng merged PR #1487:
URL: https://github.com/apache/incubator-fury/pull/1487


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org