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

Stress is slow #90

Closed
archit120 opened this issue May 21, 2020 · 7 comments
Closed

Stress is slow #90

archit120 opened this issue May 21, 2020 · 7 comments

Comments

@archit120
Copy link

I'm using the version from the store so I don't know if this is fixed in master. Running on Windows

@mfornet
Copy link
Owner

mfornet commented May 21, 2020

Stress will generate by default 10 test cases and run you solution against each of them, if your solution is taking time running sol.cpp/gen.py/brute.cpp then the slowness is on your side and is expected, however, if those three files run fast enough then there is something happening that need to be investigated. If you can confirm that your case is the latter please let me know, so I can explore further. In that case please, share with me your sol.cpp, gen.py and brute.cpp to run it locally.

What do you mean by doesn't save any changes in sol.cpp? If you mean that file is not saved before stressing, that is a bug, which I expect to be solved in current version on the store.

@archit120
Copy link
Author

What do you mean by doesn't save any changes in sol.cpp? If you mean that file is not saved before stressing, that is a bug, which I expect to be solved in current version on the store. - yes I mean exactly that. I'm running version 0.3.1.

The code shouldn't be slow. I was generating test cases of size ~10 and the time complexity is NlogN and N^2. I'll update with a more trivial example

@Salil03
Copy link
Collaborator

Salil03 commented May 21, 2020

Even I have experienced this. And the culprit (according to me) is gen.py. It takes highest time to generate input testcase

@mfornet mfornet changed the title Stress is slow and doesn't save any changes in sol.cpp Stress is slow May 24, 2020
@mfornet
Copy link
Owner

mfornet commented May 24, 2020

@archit120 I'll track the issue for saving on stress at #94

@mfornet
Copy link
Owner

mfornet commented May 24, 2020

I explore this issue together with @dgc9715, and we believe the culprit might be spawnSync in javascript, which might have a big overhead (mostly on windows). See here and here. We ran a+b code, and stress it, on my machine time reported was <6ms, but on @dgc9715 it reported ~1000ms (which is crazy).

One possible improvement is launching one binary that handles the stressing and communicate with the extension about the progress, but I prefer not to pursue this idea for now since it is much more complex, and it is not clear if it will solve the problem at all. I'm closing this issue for now, but it would still be useful if you provide the source codes of your setup, to check if there is anything else happening.

If you believe, this issue is not related to spawnSync but to something else feel free to open it.

@mfornet mfornet closed this as completed May 24, 2020
@Salil03
Copy link
Collaborator

Salil03 commented May 24, 2020

Try using https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options instead of spawnsync. How much time does it take?. You can also check this:https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback.

@mfornet mfornet reopened this May 24, 2020
@mfornet
Copy link
Owner

mfornet commented May 31, 2020

Just tested both of this functions, and couldn't find any noticeable difference on two different machines (one with Ubuntu and other with OSX)

@mfornet mfornet closed this as completed May 31, 2020
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

3 participants