Skip to content

Conversation

@dapplion
Copy link
Contributor

Javascript abstractions are not free. While using pipe here looks nice, it adds a non-neglible cost allocating Promises for each extra for await () iteration.

Move code to add prefix into encryptStream. I'll attempt the same for decryptStream but it's a bit more complex so prefer to split in two PRs

@dapplion dapplion requested a review from a team as a code owner October 14, 2022 15:03
@dapplion dapplion changed the title Add prefix in encryptStream chore: Add prefix in encryptStream Oct 14, 2022
@dapplion dapplion force-pushed the dapplion/encryptStreamPrefix branch from 646ef3c to b9568fd Compare October 14, 2022 15:07
}

export const uint16BEEncode: LengthEncoderFunction = (value: number) => {
export const uint16BEEncode = (value: number): Uint8Array => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the type changed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because LengthEncoderFunction is typed are returning either Uint8Array or Uint8Array list, requiring extra code downstream to handle both cases.

@mpetrunic
Copy link
Member

Also there are some lint issues^^

@wemeetagain wemeetagain merged commit db66eeb into master Oct 31, 2022
@wemeetagain wemeetagain deleted the dapplion/encryptStreamPrefix branch October 31, 2022 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants