Coder Social home page Coder Social logo

Slow about clipmenu HOT 9 CLOSED

cdown avatar cdown commented on August 22, 2024
Slow

from clipmenu.

Comments (9)

cdown avatar cdown commented on August 22, 2024 1

There should be a number of trivial perf improvements that can be made -- I'll look into them in the coming days.

from clipmenu.

cdown avatar cdown commented on August 22, 2024 1

It should be DEBUG=1, not DEBUG=true (it's checked with (( and (( true )) is false. :-)

from clipmenu.

hashworks avatar hashworks commented on August 22, 2024

The cause are large amounts of entries in /tmp/clipmenu.$USER. I had 500 in there and it slowed it down to >2sec. One needs to clean this directory regulary.

from clipmenu.

cdown avatar cdown commented on August 22, 2024

Part one of perf improvements is in e8ba60e, which improves performance on my machine by a little over 30%:

clipmenu perf_old % TIME_ONLY=1 test/test-perf
>>> Setting up edited clipmenu
>>> Writing 1500 clipboard files
0... 100... 200... 300... 400... 500... 600... 700... 800... 900... 1000... 1100... 1200... 1300... 1400... 1500... done
>>> Running modified clipmenu

real	0m5.238s
user	0m0.380s
sys	0m0.350s
clipmenu perf_old % NO_RECREATE=1 TIME_ONLY=1 test/test-perf
>>> Setting up edited clipmenu
>>> Not nuking/creating new clipmenu files
>>> Running modified clipmenu

real	0m5.166s
user	0m0.270s
sys	0m0.470s
clipmenu perf_old % gco perf
Switched to branch 'perf'
clipmenu perf % TIME_ONLY=1 test/test-perf              
>>> Setting up edited clipmenu
>>> Writing 1500 clipboard files
0... 100... 200... 300... 400... 500... 600... 700... 800... 900... 1000... 1100... 1200... 1300... 1400... 1500... done
>>> Running modified clipmenu

real	0m3.356s
user	0m1.100s
sys	0m1.130s
clipmenu perf % NO_RECREATE=1 TIME_ONLY=1 test/test-perf
>>> Setting up edited clipmenu
>>> Not nuking/creating new clipmenu files
>>> Running modified clipmenu

real	0m3.309s
user	0m1.180s
sys	0m0.950s

from clipmenu.

cdown avatar cdown commented on August 22, 2024

f0fe969 brings us down further to 1.5 seconds:

clipmenu perf % TIME_ONLY=1 test/test-perf
>>> Setting up edited clipmenu
>>> Writing 1500 clipboard files
0... 100... 200... 300... 400... 500... 600... 700... 800... 900... 1000... 1100... 1200... 1300... 1400... 1500... done
>>> Running modified clipmenu

real	0m1.495s
user	0m0.430s
sys	0m1.070s

from clipmenu.

cdown avatar cdown commented on August 22, 2024

I think you'll find the new version about to be pushed to develop makes things much better, test out 6edf3c4. This commit makes running time with 1500 clips basically nothing:

clipmenu perf % TIME_ONLY=1 test/test-perf
>>> Setting up edited clipmenu
>>> Writing 1500 clipboard files
0... 100... 200... 300... 400... 500... 600... 700... 800... 900... 1000... 1100... 1200... 1300... 1400... 1500... done
>>> Running modified clipmenu

real	0m0.015s
user	0m0.010s
sys	0m0.000s

from clipmenu.

cdown avatar cdown commented on August 22, 2024

Cleaned up now unneeded code and sped up further in 8885306:

clipmenu perf % TIME_ONLY=1 test/test-perf
>>> Setting up edited clipmenu
>>> Writing 1500 clipboard files
0... 100... 200... 300... 400... 500... 600... 700... 800... 900... 1000... 1100... 1200... 1300... 1400... 1500... done
>>> Running modified clipmenu

real	0m0.004s
user	0m0.000s
sys	0m0.000s

from clipmenu.

cdown avatar cdown commented on August 22, 2024

I just released 2.0.0 here (as a git tag) and on the AUR. It should be way more performant, but note that as a result of the performance improvements it is backwards incompatible, your old clips will not show up in 2.0.0.

Test it out and let me know what you think. :-)

from clipmenu.

kaihendry avatar kaihendry commented on August 22, 2024

Been using 09c32b0 this morning and so far so good. 👏 Nice work.

~$ git --git-dir ~/tmp/clipmenu/.git/ describe
2.0.0
~$ cat /home/hendry/.config/systemd/user/clipmenud.service
[Unit]
Description=Clipmenud

[Service]
Environment=DISPLAY=:0
Environment=DEBUG=true
ExecStart=/usr/local/bin/clipmenud

[Install]
WantedBy=default.target suspend.target
~$ systemctl --user status clipmenud.service
● clipmenud.service - Clipmenud
   Loaded: loaded (/home/hendry/.config/systemd/user/clipmenud.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2017-01-06 23:39:24 SGT; 12h ago
 Main PID: 2067 (clipmenud)
   CGroup: /user.slice/user-1000.slice/[email protected]/clipmenud.service
           ├─ 2067 /bin/bash /usr/local/bin/clipmenud
           ├─31437 xsel -i --clipboard
           └─32546 sleep 0.5

Jan 06 23:39:24 teefour systemd[2047]: Started Clipmenud.
~$ journalctl --user -u clipmenud.service -f
-- Logs begin at Fri 2016-04-15 20:16:20 SGT. --
Jan 02 22:55:44 teefour systemd[1959]: Started Clipmenud.
Jan 04 00:09:33 teefour systemd[1959]: Stopping Clipmenud...
Jan 04 00:09:33 teefour systemd[1959]: Stopped Clipmenud.
-- Reboot --
Jan 04 09:24:00 teefour systemd[2017]: Started Clipmenud.
Jan 05 08:56:41 teefour systemd[2017]: Stopping Clipmenud...
Jan 05 08:56:42 teefour systemd[2017]: Stopped Clipmenud.
-- Reboot --
Jan 05 09:17:37 teefour systemd[1972]: Started Clipmenud.
Jan 06 23:38:47 teefour systemd[1972]: Stopping Clipmenud...
Jan 06 23:38:47 teefour systemd[1972]: Stopped Clipmenud.
-- Reboot --
Jan 06 23:39:24 teefour systemd[2047]: Started Clipmenud.
^C
~$ ll /usr/local/bin/clipmenud
lrwxrwxrwx 1 hendry users 26 Jul 26 13:57 /usr/local/bin/clipmenud -> /home/hendry/bin/clipmenud

Was half expecting to see some logging with DEBUG set to true. Probably an issue with my systemd.

from clipmenu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.