Skip to content

Expensive instantiation of Errors to capture stack traces? #290

Description

@leiffoged

First of all, very thrilled that this library exists. I saw this on hacker news the other day and benchmarked it against the library I currently use and it's loads faster. Excellent, so I'm moving over.

For a number of reasons, I'm not able to migrate most of the queries in the code base right away, so I'm utilizing sql.unsafe to unblock these queries for now (for a number of reasons, I can't use prepared statements in these places). However, every unsafe query instantiates a new Error object to capture the stack trace at the point of query creation, which is quite expensive.

This is the line that's dominating CPU usage (over half of query-related CPU usage):

? new Error()

Is there a way I could disable this functionality? Thanks for your input and appreciate the hard work as making such an awesome library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions