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 <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to