Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slonik is 50x slower when used with ncc #646

Open
thomasthiebaud opened this issue Jan 25, 2021 · 8 comments
Open

Slonik is 50x slower when used with ncc #646

thomasthiebaud opened this issue Jan 25, 2021 · 8 comments

Comments

@thomasthiebaud
Copy link

Slonik is 10x slower when I compiled my code using ncc. I'm not sure where the issue lies, because pg does not have the same issue.

Here is a minimal repo to reproduce the issue https://github.com/thomasthiebaud/slonik-perf-issue

@thomasthiebaud thomasthiebaud changed the title Slonik is 10x slower when used with ncc Slonik is 50x slower when used with ncc Jan 25, 2021
@guybedford
Copy link
Contributor

@thomasthiebaud source maps can considerably slow down execution time. Did you try compiling with ncc without the source map?

@thomasthiebaud
Copy link
Author

@guybedford it does not seem that this is the issue. Without source and without minifying, I still have a huge perf difference for Slonik

pg - query: 6.555ms
ncc-pg - query: 12.474ms

slonik - query: 9.418ms
ncc-slonik - query: 606.6ms

You can easily reproduce the issue in that repo https://github.com/thomasthiebaud/slonik-perf-issue

@guybedford
Copy link
Contributor

@thomasthiebaud do any of the dependencies have native implementations that are only used when a native platform version is available? ncc not managing to inline such native code resulting in a JS fallback might explain the issue?

@thomasthiebaud
Copy link
Author

@guybedford
Copy link
Contributor

Right - it would be worth checking if pg-native is working via ncc itself directly.

@thomasthiebaud
Copy link
Author

It does not seem that pg-native has an issue with ncc

pg - query: 23.174ms
ncc-pg - query: 26.919ms

slonik - query: 8.378ms
ncc-slonik - query: 566.233ms

pg-native - query: 2.083ms
ncc-pg-native - query: 2.627ms

@guybedford
Copy link
Contributor

Is there any other dependency you think it could be? Because this is performance and not an actual breakage, missing native deps / slow optional deps seems the most likely cause.

@thomasthiebaud
Copy link
Author

It does not seem like there is another native dependency

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

No branches or pull requests

2 participants