Hammerspoon / Spoons

The official repository of Spoon plugins
https://www.hammerspoon.org/Spoons/
450 stars 141 forks source link

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

Closed muescha closed 3 months ago

muescha commented 2 years ago

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

xaviervalarino commented 2 years ago

@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.

muescha commented 2 years ago

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

xaviervalarino commented 2 years ago

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

muescha commented 2 years ago

@cmsj irc GitHub Action ist hanging

pecigonzalo commented 1 year ago

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

muescha commented 1 year ago

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

muescha commented 3 months ago

thx :)