-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Performance issue #150
Comments
you have the wrong measurement. const deviceDetector = new DeviceDetector();
let startPoint = performance.now();
deviceDetector.parse('');
console.log(`Time elapsed #1: ${Math.trunc(performance.now() - startPoint)}ms`);
startPoint = performance.now();
deviceDetector.parse('');
console.log(`Time elapsed #2: ${Math.trunc(performance.now() - startPoint)}ms`);
deviceDetector.parse('');
startPoint = performance.now();
console.log(`Time elapsed #3: ${Math.trunc(performance.now() - startPoint)}ms`); |
In a Google Cloud Run container we've observed that it can take up to 1.3 seconds of CPU time just to parse the user agent. This is enough that it spikes the CPU usage high enough to immediately trigger auto-scaling events from a single function call |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a sample code:
Here's the result:
So, I see here a few issues:
AMD Ryzen 7 5800HS
- which is a relatively capable CPUThe text was updated successfully, but these errors were encountered: