Jacalz / rymdport

Cross-platform application for easy encrypted file, folder, and text sharing between devices.
https://rymdport.github.io/
GNU General Public License v3.0
1.1k stars 57 forks source link

Optimize the generation of completion matches #136

Closed Jacalz closed 10 months ago

Jacalz commented 10 months ago

Checklist

Is your feature request related to a problem?

The code in https://github.com/Jacalz/rymdport/blob/main/internal/transport/completion.go is more or less a direct copy of the autocompletion generation found in Wormhole William. It has served us very well but it does allocate a lot of memory and can probably be optimized to be faster. #

Describe the solution you'd like to see.

Try to get rid of unnecessary memory allocations and speed up the algorithm. We might want to drop the strings.Split() allocations and just use a combination string.Index and other lookups. On top of this, we might want to dry to do a binary search in the wordlist to speed up prefix matching.

Jacalz commented 10 months ago

Performance improvement is improved an order of magnitude.