ddg-screen-diff icon indicating copy to clipboard operation
ddg-screen-diff copied to clipboard

Basic command response quite slow

Open GuiltyDolphin opened this issue 9 years ago • 6 comments

Commands such as ddg-screen-diff --help take a noticable time to respond - can anyone else confirm this?

GuiltyDolphin avatar Jan 20 '16 19:01 GuiltyDolphin

What kind of response time are you getting? I'm getting the following on my machine:

$ time ddg-screen-diff --help
Usage: ddg-screen-diff [--version] [--help] <command> ... [options]

Commands:
  search  Create a screenshot against a search query
  path    Create a screenshot against an arbitrary path
  ia      Create a screenshot against an IA
  group   Create a screenshot against a pre-defined group

Options:
  --version   Show version number                                                          [boolean]
  -h, --help  Show help                                                                    [boolean]


real    0m0.302s
user    0m0.296s
sys 0m0.016s

andrey-p avatar Jan 21 '16 12:01 andrey-p

@andrey-p Seems about right.

For time python --help I get:

screenshot from 2016-01-21 12 20 22

For time ddg-screen-diff --help I get:

screenshot from 2016-01-21 12 20 35

See what I mean by the delay? For something simple like --help I would expect the response to be almost instantaneous.

GuiltyDolphin avatar Jan 21 '16 12:01 GuiltyDolphin

All right yeah, I see what you mean. I think it's down to the way the modules are put together. The entry point module requires the main module, which requires all the other ddg-screen-diff modules, which require all the dependencies down to the selenium-webdriver, which is a beast.

It would be possible to delay the require() calls until the modules are actually needed, which should speed things up a bit.

Hope you don't mind if I mark this issue as low priority - I'd love it if someone dived in and fixed it, but there's other issues with the tool I need to address beforehand.

andrey-p avatar Jan 21 '16 14:01 andrey-p

@andrey-p Not at all!

Yeah, it seems a bit overkill to be loading everything just for simple calls.

GuiltyDolphin avatar Jan 21 '16 15:01 GuiltyDolphin

@andrey-p @GuiltyDolphin Can you please provide some insight into the cause of this issue? I'd love to fix this one :smile:

sahildua2305 avatar Jun 18 '16 10:06 sahildua2305

Hey @sahildua2305 - I added a rough description in my last comment, but in a bit more detail:

The main entry point for the program is: https://github.com/duckduckgo/ddg-screen-diff/blob/master/lib/run.js.

There's a lot of require()s at the top of the file, which means a lot of stuff is done at startup. Realistically, we don't need most of them until after L23. L23 is where the program checks the command line input and bails if, say, the --help argument was passed.

andrey-p avatar Jun 21 '16 09:06 andrey-p