Re: [I] [Java] generic object serialization for dubbo generic call [incubator-fury]
superchaos commented on issue #807: URL: https://github.com/apache/incubator-fury/issues/807#issuecomment-1911838299 thank for your job! -- 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-unsubscr...@fury.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@fury.apache.org For additional commands, e-mail: commits-h...@fury.apache.org
[GH] (incubator-fury): Workflow run "Fury CI" is working again!
The GitHub Actions job "Fury CI" on incubator-fury.git has succeeded. Run started by GitHub user theweipeng (triggered by theweipeng). Head commit for run: 2f2e60f8d1ee4f60cd93c26d88bdd6d90d5dc12e / weipeng feat(JavaScript): Support oneof (#1348) ### 1. Fixed a performance bug that caused writeInt32 to slow down Before: ```JavaScript // reader/index.ts function writeVarInt32() { buffer.byteLength } ``` After: ```JavaScript // reader/index.ts const byteLength = buffer.byteLength; function writeVarInt32() { byteLength } ``` The byteLength property in a Buffer is slow to access. It appears that when we access byteLength, the V8 engine processes it using a hash lookup. so we store it in closure. ### 2. Support Oneof Sometimes, the data we want to serialize does not have a confirmed type; instead, it could be one of several confirmed types. If we use an object to handle this situation, the size of the resulting binary will be too large, as it will contain much unused information. usage: ```JavaScript const oneOfThree = Type.oneof({ option1: Type.string(), option2: Type.object("foo", { a: Type.int32() }), option3: Type.int32(), }); const fury = new Fury({ refTracking: true }); const { serialize, deserialize } = fury.registerSerializer(oneOfThree); const obj = { option1: "hello" } const input = serialize(obj); const result = deserialize( input ); expect(result).toEqual(obj.option1) ``` Report URL: https://github.com/apache/incubator-fury/actions/runs/7666222936 With regards, GitHub Actions via GitBox - To unsubscribe, e-mail: commits-unsubscr...@fury.apache.org For additional commands, e-mail: commits-h...@fury.apache.org
[GH] (incubator-fury): Workflow run "Fury CI" failed!
The GitHub Actions job "Fury CI" on incubator-fury.git has failed. Run started by GitHub user theweipeng (triggered by theweipeng). Head commit for run: 2f2e60f8d1ee4f60cd93c26d88bdd6d90d5dc12e / weipeng feat(JavaScript): Support oneof (#1348) ### 1. Fixed a performance bug that caused writeInt32 to slow down Before: ```JavaScript // reader/index.ts function writeVarInt32() { buffer.byteLength } ``` After: ```JavaScript // reader/index.ts const byteLength = buffer.byteLength; function writeVarInt32() { byteLength } ``` The byteLength property in a Buffer is slow to access. It appears that when we access byteLength, the V8 engine processes it using a hash lookup. so we store it in closure. ### 2. Support Oneof Sometimes, the data we want to serialize does not have a confirmed type; instead, it could be one of several confirmed types. If we use an object to handle this situation, the size of the resulting binary will be too large, as it will contain much unused information. usage: ```JavaScript const oneOfThree = Type.oneof({ option1: Type.string(), option2: Type.object("foo", { a: Type.int32() }), option3: Type.int32(), }); const fury = new Fury({ refTracking: true }); const { serialize, deserialize } = fury.registerSerializer(oneOfThree); const obj = { option1: "hello" } const input = serialize(obj); const result = deserialize( input ); expect(result).toEqual(obj.option1) ``` Report URL: https://github.com/apache/incubator-fury/actions/runs/7666222936 With regards, GitHub Actions via GitBox - To unsubscribe, e-mail: commits-unsubscr...@fury.apache.org For additional commands, e-mail: commits-h...@fury.apache.org
(incubator-fury) branch main updated: feat(JavaScript): Support oneof (#1348)
This is an automated email from the ASF dual-hosted git repository. wangweipeng pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-fury.git The following commit(s) were added to refs/heads/main by this push: new 2f2e60f8 feat(JavaScript): Support oneof (#1348) 2f2e60f8 is described below commit 2f2e60f8d1ee4f60cd93c26d88bdd6d90d5dc12e Author: weipeng AuthorDate: Fri Jan 26 17:23:48 2024 +0800 feat(JavaScript): Support oneof (#1348) ### 1. Fixed a performance bug that caused writeInt32 to slow down Before: ```JavaScript // reader/index.ts function writeVarInt32() { buffer.byteLength } ``` After: ```JavaScript // reader/index.ts const byteLength = buffer.byteLength; function writeVarInt32() { byteLength } ``` The byteLength property in a Buffer is slow to access. It appears that when we access byteLength, the V8 engine processes it using a hash lookup. so we store it in closure. ### 2. Support Oneof Sometimes, the data we want to serialize does not have a confirmed type; instead, it could be one of several confirmed types. If we use an object to handle this situation, the size of the resulting binary will be too large, as it will contain much unused information. usage: ```JavaScript const oneOfThree = Type.oneof({ option1: Type.string(), option2: Type.object("foo", { a: Type.int32() }), option3: Type.int32(), }); const fury = new Fury({ refTracking: true }); const { serialize, deserialize } = fury.registerSerializer(oneOfThree); const obj = { option1: "hello" } const input = serialize(obj); const result = deserialize( input ); expect(result).toEqual(obj.option1) ``` --- javascript/package.json | 3 +- javascript/packages/fury/lib/description.ts | 205 -- javascript/packages/fury/lib/fury.ts | 8 +- javascript/packages/fury/lib/gen/any.ts | 43 - javascript/packages/fury/lib/gen/builder.ts | 7 + javascript/packages/fury/lib/gen/index.ts | 11 +- javascript/packages/fury/lib/gen/object.ts| 2 +- javascript/packages/fury/lib/gen/oneof.ts | 115 javascript/packages/fury/lib/gen/serializer.ts| 17 +- javascript/packages/fury/lib/meta.ts | 7 +- javascript/packages/fury/lib/platformBuffer.ts| 10 +- javascript/packages/fury/lib/reader/index.ts | 8 +- javascript/packages/fury/lib/referenceResolver.ts | 2 +- javascript/packages/fury/lib/type.ts | 25 +-- javascript/packages/hps/index.ts | 4 +- javascript/test/any.test.ts | 10 +- javascript/test/oneof.test.ts | 90 ++ 17 files changed, 467 insertions(+), 100 deletions(-) diff --git a/javascript/package.json b/javascript/package.json index a0345c20..653adfdd 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -1,7 +1,8 @@ { "scripts": { "test": "npm run build && jest", -"build": "npm run build -w packages/fury -w packages/hps", +"clear": "rm -rf ./packages/fury/dist && rm -rf ./packages/hps/dist", +"build": "npm run clear && npm run build -w packages/fury -w packages/hps", "lint": "eslint .", "lint-fix": "eslint . --fix" }, diff --git a/javascript/packages/fury/lib/description.ts b/javascript/packages/fury/lib/description.ts index 42855e4f..d332e740 100644 --- a/javascript/packages/fury/lib/description.ts +++ b/javascript/packages/fury/lib/description.ts @@ -20,112 +20,136 @@ import { InternalSerializerType } from "./type"; export interface TypeDescription { - type: InternalSerializerType - label?: string + type: InternalSerializerType; + label?: string; } export interface ObjectTypeDescription extends TypeDescription { options: { -props: { [key: string]: TypeDescription } -tag: string - } +props: { [key: string]: TypeDescription }; +tag: string; + }; } export interface EnumTypeDescription extends TypeDescription { options: { -inner: { [key: string]: any } - } +inner: { [key: string]: any }; + }; +} + +export interface OneofTypeDescription extends TypeDescription { + options: { +inner: { [key: string]: TypeDescription }; + }; } export interface ArrayTypeDescription extends TypeDescription { options: { -inner: TypeDescription - } +inner: TypeDescription; + }; } export interface TupleTypeDescription extends TypeDescription { options: { -inner: TypeDescription[] - } +inner: TypeDescription[]; + }; } export interface SetTypeDescription extends TypeDescription { options: { -key: Ty
Re: [PR] feat(JavaScript): Support oneof [incubator-fury]
theweipeng merged PR #1348: URL: https://github.com/apache/incubator-fury/pull/1348 -- 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-unsubscr...@fury.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@fury.apache.org For additional commands, e-mail: commits-h...@fury.apache.org