Date: Wed, 11 Sep 2019 09:43:18 +0300 From: Jason Thorpe <thor...@me.com> Message-ID: <f435b615-e3e4-4adf-b2ac-854a5c99d...@me.com>
| Another advantage of de-duping the name strings is that you can | compare names by testing pointer equivalence. That works only if string you're comparing against the cache entry is itself a cache entry, which would mean a whole new data struct to make lookup of those strings fast (as it is now, comparisons get a pointer to the string in the cache, and simply compare it with the lookup string .. only insert (which is relatively rare) would need to search the string cache to see if a name is already there, so that can use a slow algorithm, with no extra data struct to manage. Af for namecache operation, the proposed changes would slow down insert/delete of cache entries a little (even more for insert if de-dup is included, which would also mean adding ref counts to the strings, or a garbage collector). Lookups, which is what matters really, should be very little affected. What's more interesting to me is to know just how many long names people are seeing which are currently excluded from the cache, and would benefit from the change - that is, what percentage of all lookups fail in the cache for that reason, and do we have a histogram of the longer lengths with their frequencies (that is, would simply making the cutoff a little bigger improve things without requiring mem allocation to be added). kre