launchiamenterprise / keyrunner

KeyRunner: A secure, codeless VS Code extension for API testing & Designing. Features include data encryption at rest, sensitive data masking, and the innovative Playground for chaining API requests without coding
https://keyrunner.app
MIT License
12 stars 1 forks source link

Request Pre-Script Performance Issue #73

Open frank-duq opened 11 hours ago

frank-duq commented 11 hours ago

Describe the bug Request pre-script javascript execution has really poor performances. The pre-script that I've sent you by email @ contact@keyrunner.app takes up to 42 seconds in keyrunner to execute, while the exact same script takes less than 2 seconds in Postman (actually, the entire request/response execution takes 2s in Postman (so only the pre-script js execution part has to be less than that..), with the exact same pre-script + post-script that I've sent to you by email).

To Reproduce Steps to reproduce the behavior:

  1. Create a new request, with any random working API / http address.
  2. Add some pre-script that does quite a few things to at least generate some minimal processing to be measured in seconds (copy the pre-script I've sent to you)
  3. Run the request and notice how long it takes in the keyrunner console

Expected behavior The pre-script performances should be on par with the Postman ones, when running the exact same request/pre-script.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context My pre-script contains lots of calls to the external "faker" lib, so I'm actually wondering if the recently added support for using external lib such as "faker" in keyrunner may contain some odd behaviour where each call to the "faker" library to generate some random data (numbers, addresses, etc) may be doing some remote/network calls slowing down drastically the pre-script execution performances perhaps?

launchiamenterprise commented 11 hours ago

@frank-duq We haven't received the email with script . can you please double check if it was blocked, if you are sending it from your work email ?

we are also actively looking into the performance issue with scripts and will keep you posted. Seems like this behavior started after we implemented external libraries feature.

frank-duq commented 11 hours ago

You should have received the email by now, I think you were able to confirm in the other issue related to the same scripts that I've sent..

Thanks for looking into this @launchiamenterprise !

The other thing I've been wondering, is why the need for async/await for all interactions with the environment variables, I must admit it is quite annoying, and forces us to make all our pre or post script code and functions async with lots of "await" statements all over the place..

Is there not a way to avoid accessing "environment" in an async way, similar to the way Postman handles it?

I'm wondering if this async processing could end up having an impact on performances as well, but even if not so much, it is annoying and it would be nice if it could be converted into a regular sync access.