MarkHedleyJones / dmenu-extended

An extension to dmenu for quickly opening files and folders.
MIT License
388 stars 33 forks source link

Menu shows with noticeable delay #153

Open vestingz opened 2 years ago

vestingz commented 2 years ago

Since one of the recent updates, the menu lost its snappiness. After calling it, it shows with a noticeable delay of sth around .5 seconds, whereas before it would show instantly. Could this in any way be connected to your recent updates?

MarkHedleyJones commented 2 years ago

Interesting, thanks for the report. Yes it probably is. What version are you using? I changed the way the cache is opened v1.1.4 which may have impacted performance. Also, possibly the culprit could be the changes in v1.0.0...

For me the menu loads instantly, but if your cache is sufficiently large there may be a noticeable delay. I'll try and run some tests to see if I can pinpoint where the performance dropped.

vestingz commented 2 years ago

Thanks a lot! :)

I am using a build from the latest git revision 7ad25c0. FWIW, my cache is close to 18.000 entries (I am using your tool to access my library of scientific articles). Before, the menu opened instantly, too. Filtering is still as fast as ever.

MarkHedleyJones commented 2 years ago

Hi @vestingz Thanks for the information, I love hearing about the different ways people are using tools. 7ad25c0 is the main branch v1.1.4 which I've ran some comparisons against. For future reference I'm just going to dump the data below.

In summary, I'm not yet sure if I've been able to replicate the slow-down you've been experiencing. Initially I suspected the degradation may be due to codecs and the size of your cache. But the results seem to show that those changes didn't make much / if any difference to time taken to open the menu. What I did notice though is that the menu takes about twice as long to open, regardless of the size of the cache, since changing the installer (from about 0.22 seconds to about 0.5 seconds). This is probably related to the launcher scripts that are used to execute the menu (where are now handled by the installer).

So I would like to ask, would that change in launch-time from 0.22 seconds to 0.5 seconds explain the loss of snappiness you're experiencing?

Main Branch (v1.1.4)

Run 1

Time to open menu (empty cache)

Time to load cache of 1000 entries ...

Time to load cache of 20000 entries ...

Time to load cache of 100000 entries ...

Run 2

Time to open menu (empty cache)

Time to load cache of 1000 entries ...

Time to load cache of 20000 entries ...

Time to load cache of 100000 entries ...

Reverting removal of codecs.open (v1.1.3)

Run 1

Time to open menu (empty cache)

Time to load cache of 1000 entries ...

Time to load cache of 20000 entries ...

Time to load cache of 100000 entries ...

Run 2

Time to open menu (empty cache)

Time to load cache of 1000 entries ...

Time to load cache of 20000 entries ...

Time to load cache of 100000 entries ...

Before dropping Python2 support (v0.2.0)

Run 1

Time to open menu (empty cache)

Time to load cache of 1000 entries ...

Time to load cache of 20000 entries ...

Time to load cache of 100000 entries ...

Run 2

Time to open menu (empty cache)

Time to load cache of 1000 entries ...

Time to load cache of 20000 entries ...

Time to load cache of 100000 entries ...

Before updating installer (v0.1.0)

Run 1

Time to open menu (empty cache)

Time to load cache of 1000 entries ...

Time to load cache of 20000 entries ...

Time to load cache of 100000 entries ...

Run 2

Time to open menu (empty cache)

Time to load cache of 1000 entries ...

Time to load cache of 20000 entries ...

Time to load cache of 100000 entries ...

vestingz commented 2 years ago

@MarkHedleyJones

Thank you so much for your analysis! And yes, it has been a real pleasure to work with for someone who keeps their filenames tidy and predictable :)

It could indeed very well be the difference that the new installer created. It is hard to assess the difference subjectively, though. Could you maybe link the last commit before the new installer? I'll try to install from there and get back to you with my results.

FWIW, since I stated in my last comment that filtering is still as fast as ever: that also has gone now. There is a lag of about 0.3 - 0.5 seconds until the closest result shows, while before that was nearly instant. Maybe it is connected to some newly updated python library? These are the python packages that have been updated since recently:

[2022-07-15T13:47:39+0200] [ALPM] upgraded python-cryptography (37.0.2-1 -> 37.0.4-1)
[2022-07-15T13:47:39+0200] [ALPM] upgraded python-lxml (4.9.0-1 -> 4.9.1-1)
[2022-07-15T13:47:40+0200] [ALPM] upgraded python-astroid (2.11.6-1 -> 2.12.2-1)
[2022-07-15T13:47:40+0200] [ALPM] upgraded python-filelock (3.5.1-1 -> 3.6.0-1)
[2022-07-15T13:47:40+0200] [ALPM] upgraded python-stevedore (3.5.0-3 -> 4.0.0-1)
[2022-07-15T13:47:40+0200] [ALPM] upgraded python-zipp (3.8.0-2 -> 3.8.1-1)
[2022-07-15T13:47:41+0200] [ALPM] installed python-xvfbwrapper (0.2.9-8)
[2022-07-15T13:48:49+0200] [ALPM] upgraded python-mpv (0.5.2-3 -> 1.0.1-1)
[2022-07-29T12:26:54+0200] [ALPM] upgraded python-gobject (3.42.1-1 -> 3.42.2-1)
[2022-07-29T12:26:54+0200] [ALPM] upgraded python-numpy (1.23.0-1 -> 1.23.1-1)
[2022-07-29T12:26:54+0200] [ALPM] upgraded python-distlib (0.3.4-1 -> 0.3.5-1)
[2022-07-29T12:26:54+0200] [ALPM] upgraded python-jaraco.functools (3.5.0-2 -> 3.5.1-1)
[2022-07-29T12:26:54+0200] [ALPM] upgraded python-jaraco.text (3.8.0-2 -> 3.8.1-1)
[2022-07-29T12:26:54+0200] [ALPM] upgraded python-trove-classifiers (2022.6.26-1 -> 2022.7.22-1)
[2022-07-29T12:26:55+0200] [ALPM] upgraded python-pip (22.1.2-1 -> 22.2-1)
[2022-07-29T12:27:03+0200] [ALPM] upgraded python-soupsieve (2.3.1-1 -> 2.3.2.post1-1)
[2022-07-29T12:27:03+0200] [ALPM] upgraded python-beautifulsoup4 (4.10.0-1 -> 4.11.1-1)
[2022-07-29T12:27:03+0200] [ALPM] upgraded python-bleach (5.0.0-1 -> 5.0.1-2)
[2022-07-29T12:27:03+0200] [ALPM] upgraded python-deepdiff (5.7.0-1 -> 5.8.0-1)
[2022-07-29T12:27:03+0200] [ALPM] upgraded python-dogpile.cache (1.1.6-1 -> 1.1.7-1)
[2022-07-29T12:27:03+0200] [ALPM] upgraded python-markdown (3.3.7-1 -> 3.4.1-1)
[2022-07-29T12:27:03+0200] [ALPM] upgraded python-pylint (2.14.4-1 -> 2.14.5-1)
[2022-07-29T12:27:03+0200] [ALPM] upgraded python-simplebayes (1.5.7-9 -> 1.5.8-1)
[2022-07-29T12:27:04+0200] [ALPM] upgraded python-sphinx (5.0.2-3 -> 5.1.1-1)
[2022-08-05T14:48:43+0200] [ALPM] installed python-llfuse (1.4.1-2)
[2022-08-05T14:56:12+0200] [ALPM] upgraded python (3.10.5-1 -> 3.10.5-2)
[2022-08-05T14:56:15+0200] [ALPM] upgraded python-chardet (4.0.0-5 -> 5.0.0-1)
[2022-08-05T14:56:15+0200] [ALPM] upgraded python-platformdirs (2.5.1-1 -> 2.5.2-1)
[2022-08-05T14:56:15+0200] [ALPM] upgraded python-requests (2.27.1-1 -> 2.28.1-1)
[2022-08-05T14:56:16+0200] [ALPM] upgraded python-pip (22.2-1 -> 22.2.2-1)
[2022-08-05T14:56:21+0200] [ALPM] installed python-jarowinkler (1.2.0-2)
[2022-08-05T14:56:21+0200] [ALPM] installed python-rapidfuzz (2.4.2-2)
[2022-08-05T14:56:21+0200] [ALPM] upgraded python-levenshtein (0.12.2-3 -> 0.20.1-2)
[2022-08-05T14:56:21+0200] [ALPM] upgraded python-scipy (1.8.1-1 -> 1.9.0-2)
[2022-08-05T14:56:22+0200] [ALPM] upgraded python-apipkg (2.1.1-1 -> 3.0.1-1)
[2022-08-05T14:56:22+0200] [ALPM] upgraded python-peewee (3.14.10-1 -> 3.15.1-1)
[2022-08-05T14:56:22+0200] [ALPM] upgraded python-reportlab (3.6.10-1 -> 3.6.11-1)
[2022-08-05T14:56:22+0200] [ALPM] upgraded python-sh (1.14.2-3 -> 1.14.3-1)
[2022-08-16T19:14:21+0200] [ALPM] upgraded python (3.10.5-2 -> 3.10.6-1)
[2022-08-16T19:14:28+0200] [ALPM] installed python-autocommand (2.2.1-1)
[2022-08-16T19:14:28+0200] [ALPM] upgraded python-typing_extensions (4.2.0-1 -> 4.3.0-1)
[2022-08-16T19:14:29+0200] [ALPM] installed python-pydantic (1.9.2-1)
[2022-08-16T19:14:29+0200] [ALPM] installed python-inflect (6.0.0-1)
[2022-08-16T19:14:29+0200] [ALPM] upgraded python-jaraco.text (3.8.1-1 -> 3.9.0-1)
[2022-08-16T19:14:29+0200] [ALPM] upgraded python-trove-classifiers (2022.7.22-1 -> 2022.8.7-1)
[2022-08-16T19:14:29+0200] [ALPM] upgraded python-setuptools (1:61.3.1-1 -> 1:62.1.0-1)
[2022-08-16T19:14:29+0200] [ALPM] upgraded python-urllib3 (1.26.9-1 -> 1.26.11-1)
[2022-08-16T19:14:32+0200] [ALPM] upgraded python-dogpile.cache (1.1.7-1 -> 1.1.8-1)
[2022-08-16T19:14:32+0200] [ALPM] upgraded python-pbr (5.9.0-1 -> 5.10.0-1)
[2022-08-16T19:14:32+0200] [ALPM] upgraded python-setproctitle (1.2.3-1 -> 1.3.1-1)
[2022-08-16T19:14:32+0200] [ALPM] upgraded python-setuptools-scm (7.0.4-1 -> 7.0.5-1)
[2022-08-16T19:14:32+0200] [ALPM] upgraded python-shellingham (1.4.0-4 -> 1.5.0-1)
[2022-08-16T19:14:32+0200] [ALPM] upgraded python-tomlkit (0.11.1-1 -> 0.11.4-1)
[2022-08-16T19:26:36+0200] [ALPM] installed python-configobj (5.0.6.r110.g3e2f4cc-3)
[2022-08-16T19:26:36+0200] [ALPM] installed python-fastbencode (0.0.9-1)
[2022-08-16T19:26:36+0200] [ALPM] installed python-patiencediff (0.2.2-3)
[2022-08-19T19:08:08+0200] [ALPM] upgraded python-pyelftools (0.28-1 -> 0.29-1)
[2022-08-19T19:08:08+0200] [ALPM] upgraded python-importlib_resources (5.8.0-1 -> 5.9.0-1)
[2022-08-19T19:08:08+0200] [ALPM] upgraded python-jaraco.text (3.9.0-1 -> 3.9.1-1)
[2022-08-19T19:08:09+0200] [ALPM] upgraded python-pygments (2.12.0-1 -> 2.13.0-1)