hpc / Spindle

Scalable dynamic library and python loading in HPC environments
Other
96 stars 23 forks source link

ldcs_hash: return newly added entry to prevent excess lookup #25

Closed sam6258 closed 5 years ago

sam6258 commented 5 years ago

This is a performance improvement to the ldcs cache. If the cache is very large, lookup times can be quite a burden. This removes an excess lookup. In my testing of the cache, this shaves about 2 seconds off of a 14 second init at very small scale.

sam6258 commented 5 years ago

@mplegendre or @jjhursey could you add the appropriate reviewers/tags to this PR? I don't have the correct permissions to do so. Thanks.

mplegendre commented 5 years ago

I'll review this when it's ready. But looks like this is still a work-in-progress, correct?

sam6258 commented 5 years ago

We will probably have more PR's coming, but this should be good to go for this PR. The purpose of this PR is to just remove the excess hash lookup inside of addEntry.

mplegendre commented 5 years ago

I think a commit is missing here. This just changes the return type of the hash function, but it doesn't remove any excess hash lookups.

sam6258 commented 5 years ago

You should notice a change around this line: https://github.com/hpc/Spindle/blob/818471140288655ca6957623b3721b0eca339032/src/server/cache/ldcs_hash.c#L70

There was previously dent = ldcs_hash_Lookup(dirname);. By returning the new entry from the call to ldcs_hash_addEntry, I remove that.

This commit effectively combines these two lines in master: https://github.com/hpc/Spindle/blob/057ace51cef8f3ce47a52a4ca3bcec49d48bb640/src/server/cache/ldcs_hash.c#L70-L71