bayleeadamoss / zazu-clipboard

A clipboard manager for Zazu.
The Unlicense
14 stars 12 forks source link

Store the images externally to improve performance #17

Closed twang2218 closed 7 years ago

twang2218 commented 7 years ago

As 'nedb' cannot handle large database (e.g. more than 250MB), store the image inside database will have significant impact on performance, even usability. (For my case, the database exceed 380MB, which caused zazu-clipboard stopped working.)

To reduce such impact, this PR stores the clipboard images externally in the cache directory, 'data/images'.

This PR also improved the performance by using hash (sha1) for the clipboard change detection, which increase the performance a lot. (1000ms => 20-30 ms if it's a photo).

Also fixed the 'unitName' case to upper case.

Signed-off-by: Tao Wang twang2218@gmail.com

bayleedev commented 7 years ago

This is awesome!

One case that needs to be handled is pruning of the images. We currently have a "capped collection". We might need to do something so it stays pure (no domain logic) but still provides us a way to prune the images when the record gets deleted.

twang2218 commented 7 years ago

Updated. Now it will remove the image if the clip is removed from the database, and add more test cases.

bayleedev commented 7 years ago

Works for me, thank you!