Skip to content

[MAINT]: Investigate performance loss due to data conversions #940

@Uzlopak

Description

@Uzlopak

Describe the need

I think there is a significant performance loss happening in this module.

Lets say we run the webhook middleware not in a cloud function. We get the payload, is a buffer and transform it as a string. Then we pass it to the hashing function, which is basically transforming it back to a buffer to hash it. When we validated, we do a JSON.parse.

What we could do is to keep them buffers, till we need it to be a string for JSON.parse.

In gcf we have request.body and request.rawBody. So we dont need to call JSON.parse.

Thats what I wanted to achieve in #936

Yes having a "getPayload" function is nice to encapsulate, but it is a potential performance bottleneck.

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Breaking changeUsed to note any change that requires a major version bumpType: MaintenanceAny dependency, housekeeping, and clean up Issue or PR

    Type

    No type

    Projects

    Status

    🔥 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions