Spoons icon indicating copy to clipboard operation
Spoons copied to clipboard

EmmyLua: save timestamps of docs.json to skip if no change

Open muescha opened this issue 3 years ago • 6 comments

save timestamps in to a file timestamps.json to check if docs.json are changed. if not changed then skip the file check

add also a check to skip the writing to timestamps.json

muescha avatar Aug 08 '22 14:08 muescha

@muescha happy to see someone else was experiencing startup lag in Hammerspoon caused by EmmyLua uneccessarily reading the jsonDocs files.

I was about to submit a PR for this before I came across yours. The main difference is that I am storing timestamps in hs.settings instead of writing it out to a JSON file. I think using hs.settings as a serialized store is slightly faster than reading and writing to JSON, but the speed-up is probably negligible. You can see the diff here: https://github.com/xaviervalarino/Spoons/commit/848284ae9362c3d9a53c1a98cef7dc5d6dc9b452

Looking at yours, I do think storing the timestamp in the local settings variable is the way to go.

Hope this PR gets merged, as it significantly speeds up Hammerspoon's startup time when there are no new docs for EmmyLua to generate.

xaviervalarino avatar Sep 15 '22 20:09 xaviervalarino

My solution don't blow up the internal memory with data, which is maybe unused when he deactive the spoon.

Storing the timestamps in a file gives the user the control over the metadata.

A user can not delete the (unknown) meta data stored in hs.settings

muescha avatar Sep 15 '22 21:09 muescha

Thanks for pointing that out. I had not considered having the data hanging around.

xaviervalarino avatar Sep 15 '22 21:09 xaviervalarino

@cmsj irc GitHub Action ist hanging

muescha avatar Nov 02 '22 23:11 muescha

I believe this was ready to merge, could we re-run the CI check?

pecigonzalo avatar Jun 29 '23 07:06 pecigonzalo

@pecigonzalo I changed some whitespace to re-run CI Check - now all checks have passed :)

muescha avatar Jun 29 '23 11:06 muescha