cryptomator / cryptofs

Java Filesystem Provider with integrated encryption
GNU Affero General Public License v3.0
94 stars 35 forks source link

Cache mapping between cleartext and ciphertext directories #46

Closed overheadhunter closed 5 years ago

overheadhunter commented 5 years ago

Path encryption works by encrypting the parent directory first, which leads to a lot of recursion in CryptoPathMapper. The function getCiphertextDir is called tens of thousands of times, as path encryption happens for virtually every single I/O operation:

https://github.com/cryptomator/cryptofs/blob/28bc19a784242db7c77430edd766c03c8e5fdf0b/src/main/java/org/cryptomator/cryptofs/CryptoPathMapper.java#L134-L143

First tests have shown, that there is a huge potential to speed up path encryption by an order of magnitude when we cache directory paths, which also affects dependend operations, such as readAttributes (~ 3x speed up).