Reputation: 8877
I'm using Electron, Githubs desktop framework built using JS and HTML 5. I need to check if fileA is different to fileB, and similarly with 2 strings.
These files and strings could be of equal size but be different. They could be small (2-3 bytes) or large (2-3 megabytes).
The nature of the app means I'll need to check this every half second or so (I have some leeway with the polling time).
This data is stored in a local database, similar to sqlite. I have full control over what's in this database. My initial thought is to create and store an MD5 hash of each file/string in the database along with the mime type and size of the file/string. That way I can check for differences in size, then fallback to mime type if size is the same, and then md5 if size is the same.
My problem is the polling frequency. In a nutshell, I'm getting the clipboard contents and checking that against a db, so the size, mime type and md5 hash will need to be calculated at each poll. Mime type and size should be OK, but md5ing a 8MB image might get slow.
Is there another method I should be aware of?
Thanks
Upvotes: 1
Views: 99