savedra1 / clipse

Configurable TUI clipboard manager for Unix
MIT License
272 stars 10 forks source link

Loading takes a long time when there are a lot of items #24

Closed Vosjedev closed 5 months ago

Vosjedev commented 5 months ago

I had 100+ clipboard items, and when I tried to open the clipboard, it took so long to load I thought it was broken. I reinstalled the package multiple times, changed the pkgbuild to use the latest git commit, and then it appeard to load while I was looking at something else. I reinstalled the latest AUR version, and it seems like the problem was way to much clipboard items. (btw it also made my computer freeze for half a minute when I tried deleting the items by holding x :D)

Would it be an idea to have a configurable limit on how much items there are in the list?

savedra1 commented 5 months ago

Hi @Vosjedev :wave: thank you for raising this issue.

Firstly, there is currently a hardcoded limit of 100 items. Anything extra being added will delete the oldest entries from the history file along with any linked image files. If over 100 items are being added to your history file/tui please let me know.

It is definitely on the roadmap to make this limit configurable though, which will be something that's included in the next release.

Secondly, the freezing/slow load times is something I haven't seen happen yet but may be due to the terminal emulator you're using. If using something very lightweight like foot terminal, the resources needed to load the json file and tui could be too large. I would be interested to understand more about the terminal env and machine specs in this context.

I would also recommend using clipse -clear from the terminal instead of holding x or backspace in the tui to bulk remove items, this would be far less resource-intensive :smile:

Vosjedev commented 5 months ago

So what exactly happens is that my terminal (konsole, with all UI hidden) appears, and then nothing happens, there is a cursor blinking, but that's it.


I just tried recreating it, but I simply couldn't. Not by putting 100 20-line texts in there, not by that plus running minecraft with really heavy shaders (~95%cpu usage), I have no idea. I guess this is optimised more then enough then. If I run across it again I will share a screenrecording.

I used this to fill the clipboard btw:

for i in {1..100}; do
    echo -n "$i"; l=''
    for f in {1..20}
        do 
            a=''
            for d in {1..100}; do
                a="$a$i"
            done
         l="$l"$'\n'"$a"
    done
    echo "adding $l"
    clipse -a "$a"
done

or as oneliner

for i in {1..100}; do echo -n "$i"; l=''; for f in {1..20}; do a=''; for d in {1..100}; do a="$a$i" ; done; l="$l"$'\n'"$a"; done; echo "adding $l"; clipse -a "$a" ; done
savedra1 commented 5 months ago

Thank you for letting me know and for the script @Vosjedev.

I will close the issue then for now but feel free to get back in touch if needed.