Matt-and-Gib / gleemail

glEEmail is a novel hardware/software peer-to-peer chat application for Arduino
The Unlicense
0 stars 0 forks source link

Input Method Data Version Optimization #59

Open DualJustice opened 2 years ago

DualJustice commented 2 years ago

Currently the Input Method Data and Data Version are separate from each other, which could introduce fragility. One potential solution would be to use a hash of the Data as that data's Version. MurmurHash3 may be a good algorithm for this. This is not a vital optimization!

AVividLight commented 2 years ago

I think we separated version from the data file so that we wouldn't have to download the whole file every time. How large would a hash as a separate file be?

I do think going the hash route would be better; we don't really care about the version, we just want to know if the file needs to be updated. Not having to maintain a version number would make it simpler- just update the hash without the need to maintain continuity between versions.

DualJustice commented 2 years ago

I absolutely agree. It would be a tradeoff. Instead of only handling a single character, I believe that the smallest average size of many hash functions (including MurmurHash3) is 32 bits, or 4 bytes.

Basically, we are gaining robustness as the cost of needing to periodically calculate a hash, and storing a few more bytes (which shouldn't be a huge deal).

AVividLight commented 2 years ago

Let's do it!