gaze icon indicating copy to clipboard operation
gaze copied to clipboard

Non linear start-up time for large folders

Open chebum opened this issue 7 years ago • 3 comments

Hi,

startup.js test suite on my machine shows that startup time increases non-linearly. For 100 items per folder it's 1.5ms per file, while for 1000 items it's 7ms per file. I found two problems helper.objectPush method.

  1. When adding an array of items, the method does concatenation and allocates new array. Then again a new array is allocated inside the helper.unique method.
  2. Calling helper.unique method isn't necessary when adding a single item into the array. It's enough to call indexOf to check that the val doesn't exist in the current array.

Changes above greatly improves performance on my machine. Actually per file time reduces with growing number of files per directory.

I'll submit a PR in a minute. If the suggestions above make sense, please accept it.

Thanks,

chebum avatar Jun 28 '16 16:06 chebum

As long as this repo seems to be abandoned, take a look at this fork: https://github.com/chebum/gaze It contains a fix and use instructions.

chebum avatar Jul 12 '16 11:07 chebum

If you want to send a PR for it, the patch looks good to me. Thanks!

shama avatar Aug 03 '16 03:08 shama

@shama My fix conflicts with a test mentioned in #214. I believe the test is wrong. Could you please check if I'm correct or not?

chebum avatar Aug 04 '16 16:08 chebum